I am trying to cast a json result to a ListView in my android application.
This is my Json:
[ { "Result": "8:30,21", "Meeting": "Antwerp Olympics", "Event": "3000m", "Date": "30/05/2013" }, { "Result": "008,32", "Meeting": "Antwerp Olympics", "Event": "Long Jump", "Date": "30/05/2013" }, { "Result": "6,35", "Meeting": "Antwerp Olympics", "Event": "High Jump", "Date": "30/05/2013" }, { "Result": "5,00", "Meeting": "Antwerp Olympics", "Event": "Discus Throw", "Date": "30/05/2013" } ]
This is my Android code.
Gson gson = new Gson(); Result[] res = gson.fromJson(results, Result[].class); ListView lv1 = (ListView) getView().findViewById(R.id.sampleListView); String[] values = new String[] { }; //values ArrayAdapter<String> files = new ArrayAdapter<String>(getActivity(),android.R.layout.list_content, values); lv1.setAdapter(files);
Getting json result when working with GSON, I did it with simple json. Now I do not know how to implement this JSON result in my list. How to fill in String [] values?
Thank you in advance
user1395001
source share