values not equal in sqlite and json array in android
Posted
by
Venkat
on Stack Overflow
See other posts from Stack Overflow
or by Venkat
Published on 2012-12-17T10:52:36Z
Indexed on
2012/12/17
11:03 UTC
Read the original article
Hit count: 239
I am trying to compare the value in sqlite table and id of the webservice what i have done so far is
if(data_exist!=bookProduct.length()){
Log.i("in update","m here");
Cursor cursors = getRawEvents("select id from bcuk_book");
try{
for (int i = 0; i < bookProduct.length(); i++)
{
JSONObject c = bookProduct.getJSONObject(i);
String Bid = c.getString(TAG_ID);
ArrayList<String> mapId = new ArrayList<String>();
while(cursors.moveToNext())
{
Log.e("cursors",cursors.getString(0));
Log.i(Bid,Bid);
if(cursors.getString(0)!=c.getString(TAG_ID)){
Log.e("fas",Bid);
}
}
mapId.add(TAG_ID);
Log.e(Bid,Bid);
}
}
My issue is i am getting same values in logs..
if(cursors.getString(0)!=c.getString(TAG_ID)){
this condition says if they are not equal then print the log..But the issue is i am entering into that block even i am getting same values from sqlite and TAG_ID i.e from json webservice..How to solve this.Where i done wrong?
© Stack Overflow or respective owner