0
我试图从不同表格中获取所有数据,因此我尝试使用此方法。但是,我明白for循环是同步的,因此当解析正在获取数据时,循环不会停止。有没有人知道如何解决它?有没有可能有助于这种情况的解析方法或某些意图服务?解析:一次检索不同表格中的所有数据
private void getAllInformation(){
String controlName;
for(int i=0; i<3;i++){
if(i==0){
controlName = AppConfiguration.strEvent;
}
else if(i==1){
controlName = AppConfiguration.strStore;
}
else if (i==2){
controlName = AppConfiguration.strPromotion;
}
else{
return;
}
ParseQuery<ParseObject> query = ParseQuery.getQuery(controlName);
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> objectList, ParseException e) {
if(e!=null){
Toast.makeText(getApplicationContext(),"Error Loading.Please Try Again",Toast.LENGTH_LONG).show();
return;
}
if (objectList!= null) {
Toast.makeText(getApplicationContext(),"Success",Toast.LENGTH_LONG).show();
ParseObject.pinAllInBackground(objectList);
}
else{
Toast.makeText(getApplicationContext(),"Some Data is null!",Toast.LENGTH_LONG).show();
}
}
});
}
// getAllOfflineInformation();
}
不好的做法,加载整个数据集一次 – sector11