java - How to retrieve objects from Parse.com database and show it in Android TextView? -
i building simple mcq quiz app.
what did make database on parse.com , stored questions, possible answers , correct solution in it.
the parse.com table can seen in image: http://i.imgur.com/yxq2fx1.png
as can see, each object has question, 4 possible options , correct answer.
now, want show questions inside textview , options inside 4 different buttons. user click on correct button answer , app check if correct button pressed.
how retrieve contents specific object's attributes textview or button?
note: tried following online documentation queries. example showed how retrieve objects queries, not how show objects in textviews or how store objects inside local variable. example, know how query particular object, once object how retrieve particular attribute of object, how stored inside "optiona" field , store inside string?
i know there listview adapter, can see can't use listview here. tried following code trying convert queried objects strings, didn't work. newbie, maybe doing stupid. please me out.
try like:
query.whereequalto("ques",/*enter question number here*/); query.findinbackground(new findcallback<parseobject>(){ public void done(list<parseobject> l; parseexception e){ if(e == null){ for(int = 0; <l.size();i++){ textview.settext(l.get(i).getstring("optiona")) } } else{//handle error } } });
Comments
Post a Comment