java - Expected begin_object but was string at line 1 column 1 -
i developing android application,in that,i have task update profile image when try update image getting error,i don't know root cause of error please me how fix that.
my log below
caused by: com.google.gson.jsonsyntaxexception: java.lang.illegalstateexception: expected begin_object string @ line 1 column 1 path $ @ com.google.gson.internal.bind.reflectivetypeadapterfactory$adapter.read(reflectivetypeadapterfactory.java:200) @ com.google.gson.gson.fromjson(gson.java:810) @ com.google.gson.gson.fromjson(gson.java:775) @ com.google.gson.gson.fromjson(gson.java:724) @ com.ringee.app.imageuploadactivity$5$2.doinbackground(imageuploadactivity.java:215) @ com.ringee.app.imageuploadactivity$5$2.doinbackground(imageuploadactivity.java:206) @ android.os.asynctask$2.call(asynctask.java:288) @ java.util.concurrent.futuretask.run(futuretask.java:237) at android.os.asynctask$serialexecutor$1.run(asynctask.java:231) at java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1112) at java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:587) at java.lang.thread.run(thread.java:841) caused by: java.lang.illegalstateexception: expected begin_object string @ line 1 column 1 path $ @ com.google.gson.stream.jsonreader.beginobject(jsonreader.java:387) @ com.google.gson.internal.bind.reflectivetypeadapterfactory$adapter.read(reflectivetypeadapterfactory.java:189) at com.google.gson.gson.fromjson(gson.java:810) at com.google.gson.gson.fromjson(gson.java:775) at com.google.gson.gson.fromjson(gson.java:724) at com.ringee.app.imageuploadactivity$5$2.doinbackground(imageuploadactivity.java:215) at com.ringee.app.imageuploadactivity$5$2.doinbackground(imageuploadactivity.java:206) at android.os.asynctask$2.call(asynctask.java:288) at java.util.concurrent.futuretask.run(futuretask.java:237) at android.os.asynctask$serialexecutor$1.run(asynctask.java:231) at java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1112) at java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:587) at java.lang.thread.run(thread.java:841)
my code below
{ new asynctask<void, void, bitmap>() { @override protected bitmap doinbackground(void... arg0) { mediamo mediamo1 = new mediamo(); mediamo1.setringeeuserid(usermo.getringeeuserid()); mediamo1.setistype(constants.is_type_profile_image); string mediamo = mediadelegates.updatefiletoserver(mediamo1, context, imgfile); // string mediamo = mediadelegates.updatefiletoserver(mediamo, context, imgfile); if (!mediamo.equals("null")) { //i getting error here mediamo = gson.fromjson(mediamo, new typetoken<mediamo>() { }.gettype()); try { url url = new url(mediamo.getfilesrclink()); httpurlconnection connection = (httpurlconnection) url.openconnection(); connection.setdoinput(true); connection.connect(); inputstream input = connection.getinputstream(); return bitmapfactory.decodestream(input); } catch (ioexception e) { log.i(constants.tag, e.tostring()); } } bitmap largeicon = bitmapfactory.decoderesource(getresources(), r.drawable.ic_action_user); return largeicon; } @override protected void onpostexecute(bitmap mybitmap) { prgdialog.cancel(); imageview.setimagebitmap(mybitmap); } }.execute(null, null, null); }
my json is
{"userid":1,"mediaid":0,"istype":1,"isdelete":0}
Comments
Post a Comment