java - Access string from key value json response -


i'm getting simple json response , can't access value easily. response this

{"email":"ted@ted.com"} 

that's after doing json.tostring(). i'm trying access value of email , keep getting errors. thought

json.getstring("email") 

also in java.

edit: here errors i'm getting

07-22 06:45:11.524: e/androidruntime(9977): fatal exception: asynctask #2 07-22 06:45:11.524: e/androidruntime(9977): java.lang.runtimeexception: error occured while executing doinbackground() 07-22 06:45:11.524: e/androidruntime(9977):     @ android.os.asynctask$3.done(asynctask.java:299) 07-22 06:45:11.524: e/androidruntime(9977):     @ java.util.concurrent.futuretask$sync.innersetexception(futuretask.java:273) 07-22 06:45:11.524: e/androidruntime(9977):     @ java.util.concurrent.futuretask.setexception(futuretask.java:124) 07-22 06:45:11.524: e/androidruntime(9977):     @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:307) 07-22 06:45:11.524: e/androidruntime(9977):     @ java.util.concurrent.futuretask.run(futuretask.java:137) 07-22 06:45:11.524: e/androidruntime(9977):     @ android.os.asynctask$serialexecutor$1.run(asynctask.java:230) 07-22 06:45:11.524: e/androidruntime(9977):     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1076) 07-22 06:45:11.524: e/androidruntime(9977):     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:569) 07-22 06:45:11.524: e/androidruntime(9977):     @ java.lang.thread.run(thread.java:856) 07-22 06:45:11.524: e/androidruntime(9977): caused by: android.view.viewrootimpl$calledfromwrongthreadexception: original thread created view hierarchy can touch views. 07-22 06:45:11.524: e/androidruntime(9977):     @ android.view.viewrootimpl.checkthread(viewrootimpl.java:4609) 07-22 06:45:11.524: e/androidruntime(9977):     @ android.view.viewrootimpl.invalidatechildinparent(viewrootimpl.java:867) 07-22 06:45:11.524: e/androidruntime(9977):     @ android.view.viewgroup.invalidatechild(viewgroup.java:4066) 07-22 06:45:11.524: e/androidruntime(9977):     @ android.view.view.invalidate(view.java:10193) 07-22 06:45:11.524: e/androidruntime(9977):     @ android.widget.textview.invalidateregion(textview.java:4375) 07-22 06:45:11.524: e/androidruntime(9977):     @ android.widget.textview.invalidatecursor(textview.java:4318) 07-22 06:45:11.524: e/androidruntime(9977):     @ android.widget.textview.spanchange(textview.java:7172) 07-22 06:45:11.524: e/androidruntime(9977):     @ android.widget.textview$changewatcher.onspanadded(textview.java:8759) 07-22 06:45:11.524: e/androidruntime(9977):     @ android.text.spannablestringbuilder.sendspanadded(spannablestringbuilder.java:979) 07-22 06:45:11.524: e/androidruntime(9977):     @ android.text.spannablestringbuilder.setspan(spannablestringbuilder.java:688) 07-22 06:45:11.524: e/androidruntime(9977):     @ android.text.spannablestringbuilder.setspan(spannablestringbuilder.java:588) 07-22 06:45:11.524: e/androidruntime(9977):     @ android.text.selection.setselection(selection.java:76) 07-22 06:45:11.524: e/androidruntime(9977):     @ android.text.selection.setselection(selection.java:87) 07-22 06:45:11.524: e/androidruntime(9977):     @ android.text.method.arrowkeymovementmethod.initialize(arrowkeymovementmethod.java:302) 07-22 06:45:11.524: e/androidruntime(9977):     @ android.widget.textview.settext(textview.java:3535) 07-22 06:45:11.524: e/androidruntime(9977):     @ android.widget.textview.settext(textview.java:3405) 07-22 06:45:11.524: e/androidruntime(9977):     @ android.widget.edittext.settext(edittext.java:80) 07-22 06:45:11.524: e/androidruntime(9977):     @ android.widget.textview.settext(textview.java:3380) 07-22 06:45:11.524: e/androidruntime(9977):     @ com.reflap.reflap.editprofile$fillfields.doinbackground(editprofile.java:61) 07-22 06:45:11.524: e/androidruntime(9977):     @ com.reflap.reflap.editprofile$fillfields.doinbackground(editprofile.java:1) 07-22 06:45:11.524: e/androidruntime(9977):     @ android.os.asynctask$2.call(asynctask.java:287) 07-22 06:45:11.524: e/androidruntime(9977):     @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:305) 07-22 06:45:11.524: e/androidruntime(9977):     ... 5 more 

i'm doing in background process.

i believe stack trace not caused parsing of json data, fact asynctask referencing ui (some textview) in doinbackground method.

you reference views onpostexecute, possibly through weakreference s.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -