Issue
I have an MainActivity class. one Login class which extends AsyncTask. after execute Login class, it will return JSONObject to MainActivity like:
AsyncTask<Void, Void, JSONObject> getData = (new Login()).execute();
Now how can I separate data from getData?
my returned JOSNObject will looks like:
{"FirstName":"A","LastName":"B","ID":"09","Cell":"0123456789","Email":"[email protected]"}
or do I need to handle these in different way?
Solution
You can try this on doInBackground
:
JSONObject json = new JSONObject(StringResponse);
String FirstName = json.getString("FirstName");
String LastName = json.getString("LastName");
String ID = json.getString("ID");
String Cell= json.getString("Cell");
String Email= json.getString("Email");
Now you have data separate on differents strings.
Answered By - Aspicas
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.