Android : Parse query.whereEqualTo String issue

on Friday, October 31, 2014


I am using Parse backend for my android app. I need to query the database for a record that has a field with a specific string value. following is the Parse code


strObjectId is a String initialised with a Parse ObjectId as follows



String strObjectId = MyParseObject.getObjectId();


Parse code



ParseQuery<ParseObject> query = ParseQuery.getQuery("MyDataTable");
query.whereEqualTo("code", Code);
query.getFirstInBackground(new GetCallback<ParseObject>()
{
public void done(ParseObject object, ParseException e)
{
if (object == null)
{
return;
}
else
{
ShowToast("Record found!");
}
}
});


The problem is that it works perfectly okay when 'Code' is hardcoded as follows prior to running above query



String Code = "KrErdfgdfghdfh";


But it DOES NOT work when Code is assigned Parse ObjectId as follows



String Code = strObjectId;


Your help will be appreciated


Thanks


0 comments:

Post a Comment