我的问题是我正在使用Parse,但是当我尝试在方法中使用done方法时,它什么都不做。代码进入方法,然后不进入for循环。
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//Useless Stuff
ParseQuery<settings> query = ParseQuery.getQuery(settings.class);
query.orderByDescending("CreatedDate").setLimit(1);
query.findInBackground(new FindCallback<settings>() {
public void done(List<settings> settingsList, ParseException e) {
for (settings i : settingsList) {
if (e == null) {
Log.e("Pay Attention", "There is an object");
setVisibleInvisible();
settingsHiveNumber = i.getHiveNumber();
settingsFrameNumber = i.getFramesPerHive();
settingsHiveBodyNumber = i.getHiveBodies();
settingsSuperNumber = i.getSupers();
settingsYearsOfBeekeeping = i.getYearsofBeekeeping();
settingsLocation = i.getLocation();
setLablesTo(settingsLocation, settingsHiveNumber, settingsFrameNumber, settingsHiveBodyNumber, settingsYearsOfBeekeeping, settingsSuperNumber);
}
else {
if(e.getCode() == ParseException.OBJECT_NOT_FOUND)
{
Log.e("Pay Attention", "Got OBJECT NOT FOUND ERROR");
PreferencesChange();
}
else {
Log.e("Pay Attention", "Nothing");
}
}
}
}
});
return rootView;
}