android - How to display the image from JSON object string -



android - How to display the image from JSON object string -

im new android..

im facing problem in app..

i've been trying several ways of displaying json images solutions never succeeded.

in database images stored in folder. in json object got scr path image. want display image in emulator.i got path in json object : "imgsrc=question/images/u2_1_l2_q66". have stored path in imgarr array.

how display image path? want add together images folder drawables.please help me. lot.

code

protected string doinbackground(string... args) { list<namevaluepair> params = new arraylist<namevaluepair>(); params.add(new basicnamevaluepair("tid", tid)); json = jsonparser.makehttprequest(url_get_quesurl, "get", params); log.d("all groups: ", json.tostring()); seek { int success = json.getint(tag_success); if (success == 1) { system.out.println("success"); groups = json.getjsonarray(tag_group); system.out.println("result success+++"+groups); (int = 0; < groups.length();i++) { jsonobject c = groups.getjsonobject(i); string question = c.getstring(tag_ques); system.out.println("checking ::"+question); ques1.add(question); string img = c.getstring(tag_image); system.out.println("checking ::"+img); imgarr.add(img); } } else { showalert(); } } grab (jsonexception e) { system.out.println("error "+e.tostring()); } homecoming null; } protected void onpostexecute(string file_url) { pdialog.dismiss(); ques1=new arraylist<string>(new arraylist<string>(ques1)); imgarr=new arraylist<string>(new arraylist<string>(imgarr)); textview txtque = (textview) findviewbyid(r.id.que_txt); txtque.settext("q" + num + ")" + ques1.get(j) + imgarr.get(g)); }

in database images stored in folder

after have total path file, pass wrapped file object bitmapfactory, , display bitmap in imageview

private bitmap decodefile(file f) { seek { //you might want downscale it.... homecoming bitmapfactory.decodestream(new fileinputstream(f),null,o); } grab (filenotfoundexception e) { //throw exception } homecoming null; }

android json image

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -