Android type mismatch error in Json -
**i think facing problem on passing request youtube json list
**public class getyoutubeuservideostask implements runnable {
public static final string library = "library"; private final handler replyto; private final string username; public httpurirequest request; public getyoutubeuservideostask(handler replyto, string username) { this.replyto = replyto; this.username = username; } @override public void run() { try { httpclient client = new defaulthttpclient(); httpurirequest request = new httpget("https://gdata.youtube.com/feeds/api/videos?author=" +username+"pl25zd6tonofvkhbbrcaufkgs00d1it2h9"); httpresponse response = null; response = client.execute(request); string jsonstring = streamutils.converttostring(response.getentity().getcontent()); jsonobject json = new jsonobject(jsonstring); jsonobject response1 = json.getjsonobject("response"); jsonarray jsonarray = response1.getjsonarray("items"); list<video> videos = new arraylist<video>(); (int = 0; < jsonarray.length(); i++) { jsonobject jsonobject = jsonarray.getjsonobject(i); string title = jsonobject.getstring("title"); log.i("...........",title); string url; try { url = jsonobject.getjsonobject("player").getstring("mobile"); } catch (jsonexception ignore) { url = jsonobject.getjsonobject("player").getstring("default"); } string thumburl = jsonobject.getjsonobject("thumbnail").getstring("sqdefault"); videos.add(new video(title, url, thumburl)); } library lib = new library(username, videos); bundle data = new bundle(); data.putserializable(library, lib); message msg = message.obtain(); msg.setdata(data); replyto.sendmessage(msg); } catch (clientprotocolexception e) { e.printstacktrace(); } catch (ioexception e1) { e1.printstacktrace(); } catch (jsonexception e2) { e2.printstacktrace(); }
i new android , trying parse json getting type mismatch error. please me out.
i don't know getting wrong. logcat is
11-12 07:45:59.953 27498-28258/com.example.titus.abc w/system.err: org.json.jsonexception: value (jsonobject.java:159) 11-12 07:45:59.953 27498-28258/com.example.titus.abc w/system.err: @ org.json.jsonobject.(jsonobject.java:172) 11-12 07:45:59.953 27498-28258/com.example.titus.abc w/system.err: @ com.example.titus.abc.getyoutubeuservideostask.run(getyoutubeuservideostask.java:48)
Comments
Post a Comment