Guest User

Untitled

a guest
Oct 17th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. String s = getJSONFile();
  2. String myDataArray[] = {};
  3.  
  4. try{
  5. JSONObject reportJSON = new JSONObject();
  6. JSONArray dateJSON = reportJSON.getJSONArray("terrestrial_date");
  7.  
  8. myDataArray = new String[dateJSON.length()];
  9. for (int i = 0; i <dateJSON.length(); i++){
  10. JSONObject jsonObject = dateJSON.getJSONObject(i);
  11. myDataArray[i] = jsonObject.getString("terrestrial_date");
  12. }
  13. }catch (JSONException e){
  14. e.printStackTrace();
  15. }
  16.  
  17. ArrayAdapter<String> stringAdapter = new ArrayAdapter<String>(getApplicationContext(), R.layout.row, myDataArray);
  18. if (mListView != null){
  19. mListView.setAdapter(stringAdapter);
  20. }
Add Comment
Please, Sign In to add comment