Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. {
  2. "result": {
  3. "response": "OK",
  4. "message": "Authentication was successful.",
  5. "credencial": {
  6. "credencial": {
  7. "name": "hello world",
  8. "username": "a",
  9. "email": "a@gmail.com",
  10. "id": "58"
  11. }
  12. }
  13. }
  14. }
  15.  
  16. protected void onPostExecute(JSONObject jsonObject) {
  17. if (jsonObject != null) {
  18. String jsondata, ddd;
  19.  
  20. try {
  21. //JSONObject jsonObj = new JSONObject("result");
  22. jsondata = jsonObject.getString("result");
  23. Toast.makeText(getApplicationContext(), jsondata,
  24. Toast.LENGTH_LONG).show();
  25. pDialog.dismiss();
  26.  
  27. Intent i = new Intent(LoginActivity.this, MainActivity.class);
  28. startActivity(i);
  29. finish();
  30.  
  31. } catch (JSONException e) {
  32. // TODO Auto-generated catch block
  33. e.printStackTrace();
  34. Toast.makeText(getApplicationContext(), "exception",
  35. Toast.LENGTH_SHORT).show();
  36. pDialog.dismiss();
  37. }
  38. }
  39. //}
  40. }
  41.  
  42. protected void onPostExecute(JSONObject jsonObject) {
  43. if (jsonObject != null) {
  44. String jsondata, ddd;
  45.  
  46. try {
  47. JSONObject jsonObj = jsonObject.getJsonbject("result");
  48. JSONObject credencialObj1 = jsonObj.getJsonObject("credencial");
  49. JSONObject credencialObj2 = credencialObj1.getJsonObject("credencial");
  50.  
  51. String name = credencialObj2.getString("name");
  52. // so on
  53.  
  54. } catch (JSONException e) {
  55. // TODO Auto-generated catch block
  56. e.printStackTrace();
  57. Toast.makeText(getApplicationContext(), "exception",
  58. Toast.LENGTH_SHORT).show();
  59. pDialog.dismiss();
  60. }
  61. }
  62. }
  63.  
  64. JSONObject jsonObj = new JSONObject(jsondata);
  65.  
  66. String message = jsonObj.getString("message");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement