Do something like the following. The View with the empty id is used automatically when the ListAdapter has no data for the ListView.
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <ListView android:id="@android:id/list" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@android:id/empty" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/no_notes"/> </LinearLayout> -- Jack Ha Open Source Development Center ・T・ ・ ・Mobile・ stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Aug 19, 6:42 am, Eurig Jones <[email protected]> wrote: > Thanks Mark. > > Yeah, I saw that in the docs but I'm using a non-custom List, I have > no custom layout and I don't intend to create one. How could I specify > an empty view if my list returns no records? > > On Aug 19, 11:24 pm, Mark Murphy <[email protected]> wrote: > > > Eurig Jones wrote: > > > Does anyone know if it's possible to show a "Currently have no items" > > > type view in a ListActivity when, obviously, you have no items? > > >http://developer.android.com/reference/android/app/ListActivity.html > > > "Optionally, your custom view can contain another view object of any > > type to display when the list view is empty. This "empty list" notifier > > must have an id 'android:empty'. Note that when an empty view is > > present, the list view will be hidden when there is no data to display." > > > -- > > Mark Murphy (a Commons > > Guy)http://commonsware.com|http://twitter.com/commonsguy > > > Need Android talent? Ask on HADO!http://wiki.andmob.org/hado > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

