Gerardo
Gerardo

Reputation: 5830

How to display a special message if a filtered list view contains no results any more?

Is there any way to show a message such as "No results" when i filter a list?

Upvotes: 1

Views: 1015

Answers (1)

Emmanuel
Emmanuel

Reputation: 17051

Easy. Next to your list view, add this text view:

<TextView android:id="@id/android:empty"
               android:layout_width="match_parent"
               android:layout_height="match_parent"
               android:text="@string/empty_list_message"/>

The ID is important; the ListActivity will look for it.

Emmanuel

Upvotes: 3

Related Questions