And the ListView
if the default ListView
Whose Id is
android:id="@android:id/list"
And here is the code that i use to set Adapter
getListView().setAdapter(mAdapter);
I want to call a method after this Adapter
is fully loaded.
And the ListView
if the default ListView
Whose Id is
android:id="@android:id/list"
And here is the code that i use to set Adapter
getListView().setAdapter(mAdapter);
I want to call a method after this Adapter
is fully loaded.
If you still need a callback to be invoked after every child view was shown to the user at least once (because it seems like that is what you want to achieve), try this tested code inside your adapter:
private boolean mFullyLoaded = false;
@Override
public View getView(int index, View convertView, ViewGroup parent) {
if (convertView == null) {
// inflation code here
}
if (!mFullyLoaded && index == getCount() - 1) {
mFullyLoaded = true;
// "fully loaded"-code here
}
return convertView;
}
The bottom if-clause is only true when the bottommost child of the ListView is displayed. At that point, as long as you didn't manually set the scroll position and thus jumped over some children, every child view was loaded/displayed at least once. The boolean-flag makes sure the code only fires once.