android - Parse: Retrieve all data from different table at once -


i trying data different table tried use method. however, understand loop synchronous loop didn't stop when parse fetching data. did idea how solve it? there got parse method or intent services may situation?

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 null!",toast.length_long ).show();                 }               }          });       }   //        getallofflineinformation(); } 

you can use locks:

object lock = new object();  parsequery<parseobject> query = parsequery.getquery(controlname);         query.findinbackground(new findcallback<parseobject>() {             public void done(list<parseobject> objectlist, parseexception e) {   synchronized (lock) {             lock.notifyall();         }                 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 null!",toast.length_long ).show();                 }               }          });   synchronized (lock) {     lock.wait(); } 

Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -