Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. refresh_btn.setOnClickListener(new OnClickListener() {
  2. @Override
  3. public void onClick(View v) {
  4.  
  5. HttpHandler httpHandler1 = new HttpHandler();
  6. String res = null;
  7. String authToken = "MlSyULrWlFgVk28";
  8.  
  9. try {
  10.  
  11. Log.d("edwLog", TAG + " get_payment_notifications " + HttpHandler.API_URL + "get_payment_notifications/" + authToken + "/");
  12. res = httpHandler1.makeServiceCall(HttpHandler.API_URL + "get_payment_notifications/" + authToken + "/", HttpHandler.GET);
  13. Log.d("edwLog", TAG + " response > " + res);
  14. if (res != null) {
  15. JSONObject jsonObject = new JSONObject(res);
  16. String responseType = jsonObject.getString("type");
  17. if (responseType.equals("success")) {
  18. if (jsonObject.has("response")) {
  19.  
  20. JSONArray jsonArray = jsonObject.getJSONArray("response");
  21. for (int i = 0; i < jsonArray.length(); i++) {
  22. notifications.add(jsonArray.getJSONObject(i));
  23. }
  24. }
  25. }
  26. }
  27.  
  28. } catch (Exception e) {
  29. e.printStackTrace();
  30. Log.d("edwLog", TAG + " IOException > " + e.toString());
  31. }
  32. }
  33. });
  34.  
  35. public void onClick(View v)
  36.  
  37. refresh_btn.setOnClickListener(new OnClickListener() {
  38. @Override
  39. public void onClick(View v) {
  40.  
  41. HttpHandler httpHandler1 = new HttpHandler();
  42. String res = null;
  43.  
  44.  
  45. try {
  46.  
  47. Log.d("edwLog", TAG + " get_payment_notifications " + HttpHandler.API_URL + "get_payment_notifications/" + AuthToken + "/");
  48. res = httpHandler1.makeServiceCall(HttpHandler.API_URL + "get_payment_notifications/" + AuthToken + "/", HttpHandler.GET);
  49. Log.d("edwLog", TAG + " response > " + res);
  50. if (res != null) {
  51. JSONObject jsonObject = new JSONObject(res);
  52. String responseType = jsonObject.getString("type");
  53. if (responseType.equals("success")) {
  54. if (jsonObject.has("response")) {
  55.  
  56. JSONArray jsonArray = jsonObject.getJSONArray("response");
  57. for (int i = 0; i < jsonArray.length(); i++) {
  58. notifications.add(jsonArray.getJSONObject(i));
  59. }
  60. }
  61. }
  62. }
  63.  
  64. } catch (Exception e) {
  65. e.printStackTrace();
  66. Log.d("edwLog", TAG + " IOException > " + e.toString());
  67. }
  68. }
  69. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement