我使用Parse作为数据库。
我试图编写一个搜索本地信息的函数,以便在co出现时对它们进行解析!
但是当我查询我的LocalDataStore
时,它不等待抓取,所以它返回null><
ParseQuery<ParseObject> query = ParseQuery.getQuery("PatientsAndroid");
query.whereEqualTo("Mobile", Build.SERIAL);
query.getFirstInBackground(new GetCallback<ParseObject>() {
@Override
public void done(ParseObject patient, com.parse.ParseException e)
{
if(e==null)
{
ArrayList<HashMap<String, ?>> trueLala = get_data_from_local()
put... [...] saveInBackground[...]
}
}});
我的函数get_data_from_local()必须从local返回值:
ArrayList<HashMap<String, ?>> Lala = new ArrayList<HashMap<String, ?>>();
Lala = null;
ParseQuery<ParseObject> query = ParseQuery.getQuery("PatientsAndroid");
query.fromLocalDatastore();
query.getFirstInBackground(new GetCallback<ParseObject>()
{
@SuppressWarnings("unchecked")
@Override
public void done(ParseObject patient, com.parse.ParseException e)
{
Log.i("MOI", "On est dans la done ou PAS ?");
if(e==null) // There is the object !
{
try
{
Lala = (ArrayList<HashMap<String, ?>>) patient.get("Examens");
// BASICALLY I WANT Lala to be return to first function up there !
patient.unpin();
}
catch (ParseException e1)
{
Log.i("MOI", "erreur destruction du localStorage + "+e1.toString());
}
}
}
});
}
catch(Exception e8)
{
Log.i("MOI", "erreur de query ! + "+e8.toString());
}
return Lala;
}
但是&#34; trueLala&#34;在测试时为null:/并且它是因为函数返回我在为实例化返回值的数组时放置的空值....
我该怎么做?