android voally exception error not showing on the log cat -
i have below code using volley, having blank page when opening app , when click on php link returning values.
why showing white blank on opening ? getting exception not able read can me ?
this line of error
d/volley(4754): [1] 2.onerrorresponse: mainactivity
this code
jsonarrayrequest moviereq = new jsonarrayrequest(url, new response.listener<jsonarray>() { @override public void onresponse(jsonarray response) { log.d("r", response.tostring()); hidepdialog(); system.out.print(response); // parsing json (int = 0; < response.length(); i++) { try { jsonobject obj = response.getjsonobject(i); movie movie = new movie(); movie.settitle(obj.getstring("name")); movie.setthumbnailurl(obj.getstring("path")); movie.setrating(obj.getstring("description")); // movie.setrating(((number) obj.get("description")) // .doublevalue()); movie.setyear(obj.getstring("likes")); // movie.setyear(obj.getint("likes")); // genre json array jsonarray genrearry = obj.getjsonarray("comments"); arraylist<string> genre = new arraylist<string>(); (int j = 0; j < genrearry.length(); j++) { genre.add((string) genrearry.get(j)); } movie.setgenre(genre); // adding movie movies array movielist.add(movie); } catch (jsonexception e) { e.printstacktrace(); } } // notifying list adapter data changes // renders list view updated data adapter.notifydatasetchanged(); } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror error) { system.out.print(error); volleylog.d(tag, "error: " + error.getmessage()); hidepdialog(); } });
this log cat
07-30 13:06:47.319: i/personamanager(4754): getpersonaservice() name persona_policy 07-30 13:06:47.409: e/moreinfohpw_viewgroup(4754): parent view not textview 07-30 13:06:47.449: d/abslistview(4754): motionrecognitionmanager 07-30 13:06:47.549: d/abslistview(4754): onvisibilitychanged() called, visibility : 4 07-30 13:06:47.549: d/abslistview(4754): unregisterirlistener() called 07-30 13:06:47.579: d/abslistview(4754): onvisibilitychanged() called, visibility : 0 07-30 13:06:47.579: d/abslistview(4754): unregisterirlistener() called 07-30 13:06:47.664: i/(4754): platform version : jb-mr-2 07-30 13:06:47.754: d/mali_winsys(4754): new_window_surface returns 0x3000 07-30 13:06:47.769: d/openglrenderer(4754): enabling debug mode 0 07-30 13:06:47.779: d/progressbar(4754): updatedrawablebounds: left = 0 07-30 13:06:47.779: d/progressbar(4754): updatedrawablebounds: top = 0 07-30 13:06:47.779: d/progressbar(4754): updatedrawablebounds: right = 144 07-30 13:06:47.779: d/progressbar(4754): updatedrawablebounds: bottom = 144 07-30 13:06:47.779: d/abslistview(4754): unregisterirlistener() called 07-30 13:06:47.809: d/mali_winsys(4754): new_window_surface returns 0x3000 07-30 13:06:47.834: d/abslistview(4754): unregisterirlistener() called 07-30 13:06:47.904: d/abslistview(4754): unregisterirlistener() called 07-30 13:06:47.979: i/system.out(4754): thread-6768(httplog):isshipbuild true 07-30 13:06:47.979: i/system.out(4754): thread-6768(httplog):smartbonding enabling false, ship_build true, log file false, dbg false 07-30 13:06:48.049: d/volley(4754): [1] 2.onerrorresponse: mainactivity 07-30 13:06:48.064: d/abslistview(4754): unregisterirlistener() called 07-30 13:06:48.069: e/viewrootimpl(4754): senduseractionevent() mview == null
edit:
after removed word "result", able catch error :
07-30 13:32:41.384: w/system.err(16258): org.json.jsonexception: value
[{"path":"http://api.androidhive.info/json/movies/1.jpg","comments":" nice","description":"long story","likes":"5","name":"50 shade of gray"},{"path":"http://api.androidhive.info/json/movies/2jpg","comments":" beautiful","description":"robots","likes":"7","name":"transformers"},{"path":"http://api.androidhive.info/json/movies/3.jpg","comments":" wow","description":"hulk , iron man","likes":"8","name":"avangeers"}] @ 0 of type org.json.jsonarray cannot converted jsonobject
but in php have edit
echo json_encode(array($result));
should'nt encode ?
actually there 2 problem in resposne given below solutions:-
1.your resposne not appropriate json object. response contains ?> @ end raised parsing error. removed api response.
2.your resposne json object. instead of using jsonarrayrequest use jsonobjectrequest class.
have peace , enjoy!!!
Comments
Post a Comment