The only reasons getView
is not called are:
getCount
returns 0.- you forget to call
setAdapter
on theListView
. - If the
ListView
‘s visibility (or its container’s visibility) isGONE
. Thanks to @TaynãBonaldo for the valuable input. ListView
is not attached to any viewport layout. That is,mListView = new ListView(...)
is used withoutmyLayout.addView(mListView)
.
In the onPostExcute
, after you create a new instance of CarListAdapter
I will suggest you to update the new instance to your ListView
. Indeed you need to call again
mList.setAdapter(adapter);
Edit: setAdapter
should be always called on the ui thread, to avoid unexpected behaviours
Edit2:
The same applies to RecyclerView
. Make sure that
getItemCount
is returning a value grater than0
(usually the dataset size)- both
setLayoutManager
andsetAdapter
have to be called on theUI Thread
- The visibility of the widget has to be set to
VISIBLE