Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. new Response.Listener<String>() {
  2. @Override
  3. public void onResponse(String response) {
  4. //Do Something with the data
  5. try {
  6. JSONObject jsonObject = new JSONObject(response);
  7. JSONArray jsonArray = jsonObject.getJSONArray("json");
  8. for (int i = 0; i < jsonArray.length(); i++) {
  9. JSONObject questionSet = jsonArray.getJSONObject(i);
  10. Questions[i] = questionSet.getString("Question");
  11. Questions[i].replaceAll("$$","\\");
  12. Answer1[i] = questionSet.getString("Option1");
  13. Answer1[i].replace('$','\');
  14. Answer2[i] = questionSet.getString("Option2");
  15. Answer2[i].replace('$','\');
  16. Answer3[i] = questionSet.getString("Option3");
  17. Answer3[i].replace('$','\');
  18. Answer4[i] = questionSet.getString("Option4");
  19. Answer4[i].replace('$','\');
  20. Correct[i] = questionSet.getString("Correct");
  21. Toast.makeText(getApplicationContext(),Questions[i]+Answer1[i],Toast.LENGTH_SHORT).show();
  22. }
  23. setFirstTabsData();
  24.  
  25. }catch (JSONException e){
  26. e.printStackTrace();
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement