android - Java Arrays.asList(columnes).contains() return false -
in application have columnes
variable data :
list<string> columnes = getsinglecolumn("id");
now i'm trying check single string array :
arrays.aslist(columnes).contains("1")
this check allways return false
my full code:
list<string> columnes = getsinglecolumn("id"); (int = 0; < jsonarray.length(); i++) { jsonobject item = jsonarray.getjsonobject(i); clist = new categories(); clist.id = integer.parseint(item.getstring(sv.field_category_id)); clist.title = item.getstring(sv.field_category_title); clist.followers = item.getstring(sv.field_category_followers); clist.type = item.getstring(sv.field_category_type); clist.date = item.getstring(sv.field_category_date); clist.imageurl = item.getstring(sv.field_category_image_url); log.e("check : ", arrays.aslist(columnes).contains(clist.id+"")); } catch (jsonexception e) { }
arrays.aslist(list)
returns list<list<string>>
not list<string>
contains method can not find string in list of list (from @task's answer).therefore change
log.e("check : ", arrays.aslist(columnes).contains(clist.id+""));
to
log.e("check : ", columnes.contains(string.valueof(clist.id)));
and check value of clist.id
as
log.e("clist id value: ", string.valueof(clist.id));
Comments
Post a Comment