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
Post a Comment