Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Ivan Rios
2,050 PointsbloagReader
I'm at the step where we populate the array with the json data, but the data does not display in the emulator, what i get is: " No item to display.
public void updateList() {
if (mBlogData == null){
}
else{
try {
JSONArray jsonPosts = mBlogData.getJSONArray("posts");
mBlogPostTitles = new String[jsonPosts.length()];
for(int i = 0; i < jsonPosts.length(); i++){
JSONObject post = jsonPosts.getJSONObject(i);
String title = post.getString("tittle");
title = Html.fromHtml(title).toString();
mBlogPostTitles[i] = title;
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_expandable_list_item_2, mBlogPostTitles);
setListAdapter(adapter);
} catch (JSONException e) {
Log.e(TAG, "Exception caught!", e);
}
}
Can someone help me please!!! :(
2 Answers
Paul Panayotou
5,001 PointsThere's a misspelled "title" in your: String title = post.getString("title"); line
Ivan Rios
2,050 PointsYes!! thank you!! :)