Created
January 11, 2014 17:40
-
-
Save aemxn/8374109 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onPostExecute(String json) { | |
try { | |
categories = new JSONArray(json); | |
if (categories != null) { | |
// looping through All albums | |
for (int i = 0; i < categories.length(); i++) { | |
JSONObject c = categories.getJSONObject(i); | |
// Storing each json item values in variable | |
String id = c.getString(TAG_ID); | |
String name = c.getString(TAG_NAME); | |
String songs_count = c.getString(TAG_CATEGORIES_COUNT); | |
String category_logo = c.getString(TAG_CATEGORIES_LOGO); | |
// creating new HashMap | |
HashMap<String, String> map = new HashMap<String, String>(); | |
// adding each child node to HashMap key => value | |
map.put(TAG_ID, id); | |
map.put(TAG_NAME, name); | |
map.put(TAG_CATEGORIES_COUNT, songs_count); | |
map.put(TAG_CATEGORIES_LOGO, category_logo); | |
// adding HashList to ArrayList | |
categoryList.add(map); | |
} | |
mAdapter = new CategoryListAdapter(CategoryActivity.this, categoryList); | |
getListView().setAdapter(mAdapter); | |
pDialog.dismiss(); | |
} else { | |
Log.d("Categories: ", "null"); | |
} | |
} catch (JSONException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment