I have a tabbed layout and an activity using tabs as views. It has three tabs as ListViews
. If either of the lists is empty I want to show a simple TextView>
You can solve this by adding an empty item when the list is empty. The following example is based on your pre-EDIT code:
FrameLayout frameLayout = (FrameLayout) findViewById(android.R.id.tabcontent);
mListView_top10 = (ListView)findViewById(R.id.Top_10);
if (TopWR.size() == 0) {
// add a single item to the array, in order to indicate the list is empty
TopWR.add("The List Is Empty");
}
mListView_top10.setAdapter(new ArrayAdapter(this, R.layout.listview_row,TopWR));
If you want to get fancier with how the empty list is displayed you can replace ArrayAdapter with a custom adapter. You can also use a different adapter when the list is empty.