Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try
- {
- JSONObject json = new JSONObject(result);
- JSONArray response = json.optJSONArray("response");
- String[] tracks = new String[response.length()];
- for(int i = 0; i < response.length(); i++)
- {
- JSONObject item = response.getJSONObject(i);
- String artist = item.getString("artist");
- String title = item.getString("title");
- tracks[i] = artist + " - " + title;
- }
- ListView lv = (ListView) findViewById(R.id.listView1);
- ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
- android.R.layout.simple_list_item_1, tracks);
- lv.setAdapter(adapter);
- }
- catch (JSONException e)
- {
- NotifyDialog(e.getMessage());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement