Android Setlistadapter Error
hi just getting an error and I'm not sure why can anyone help? when i run it it forces the application to close. not sure what this means as i'm new but hopefully someone can help?
Solution 1:
I am guessing that you have another declaration of String oneObjectsItem
which is not initialized. Then you create (by mistake?) another string inside for
loop and init it, while the first one is left as null
.
If I understand your logic correctly it could be something like this:
List<String> titles = newArrayList<String>();
for (int i=0; i < jArray.length(); i++){
oneObject = jArray.getJSONObject(i);
// Pulling items from the array
titles.add(oneObject.getString("title"));
}
setListAdapter ( newArrayAdapter<String>(this, R.layout.single_item, titles));
Post a Comment for "Android Setlistadapter Error"