android - Synchronous query? -


how implement synchronous query parse in android? want below, synchronous way.

    parsequery<parseobject> query = parsequery.getquery("myclass");     query.findinbackground(new findcallback<parseobject>() {     public void done(list<parseobject> objects, parseexception e) {          if (e == null) {              objectswereretrievedsuccessfully(objects);          } else {              objectretrievalfailed();          }      }  } 

use parsequery#find() perform query , block until finished. following should work:

parsequery<parseobject> query = parsequery.getquery("myclass"); try {     list<parseobject> objects = query.find();     objectswereretrievedsuccessfully(objects); } catch (parseexception e) {     objectretrievalfailed(); } 

however, mentioned others, blocking main thread not idea doing makes ui unresponsive.


Comments

Popular posts from this blog

Combining PHP Registration and Login into one class with multiple functions in one PHP file -

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -