my own activity extends the ListActivity for the following reason:
<ListView
android:id="@android:id/list"
android:layout_below="@+id/h_exercises"
android:layout_above="@+id/btn_add_exercise"
android:layout_marginTop="20dip"
style="@style/general_list_view" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@android:id/list"
android:layout_marginTop="20dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/info_no_exercises_in_DB"
android:id="@android:id/empty"
android:layout_above="@+id/btn_add_exercise"/>
So if the Activity extends ListActivity and u got a view with id "@android:id/empty", the view will be shown if the list is empty.
But since my Activity needs an ActionBar i need to extend my Activity by ActionBarActivity. So is there a way to implement this scenario programmatically?
Maybe something like:
@Override
protected void onResume() {
if (listview.getCount()!=0){
textview.setVisibility(View.GONE);
} else {
listview.setVisibility(View.GONE);
}
}
Thanks for your help and suggestions
greets Pebbles
You can use a ListFragment and put it inside an ActionBarActivity. ListFragment has built-in empty view feature.