Skip to content Skip to sidebar Skip to footer

Listview Loads With No Data-android

MessagesActivity.java package org.example.fbapp; import java.io.FileNotFoundException; import java.io.IOException; import java.net.MalformedURLException; import java.util.ArrayLis

Solution 1:

Because you're calling the setListAdapter(adapter) for implicit (Activity's) ListView in the onCreate(Bundle savedInstanceState) method and in the getGPosts() method you reference the correct (visible) ListView. Simply change the mentioned call in the onCreate(Bundle savedInstanceState) method to:

myListView = getListView();
myListView.setAdapter(adapter);

And you should be fine! Good luck!

P.S. This solution will work if your ListActivity follows the following requirement:

your own view MUST contain a ListView object with the id "@android:id/list"

from Google's documentation

Solution 2:

As I see you are extending ListActivity. So below code must throw a NPE.

lv = (ListView)findViewById(R.id.list);
lv.setAdapter(adapter);

You should use below code at onComplete method instead;

setListAdapter(adapter);

or

getListView().setAdapter(adapter);

Post a Comment for "Listview Loads With No Data-android"