1

I've an activity with a ListView. When there are no items to show in the ListView, I want to show a TextView with a message "No elements found". So I add a TextView with the "android:id/empty" id.

<ListView android:id="@android:id/list"
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           android:layout_weight="1"
           android:drawSelectorOnTop="false"
           />

<TextView android:id="@android:id/empty"
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           android:text="@string/noSeHanEncontradoConsumos"
           android:gravity="center"  
           android:visibility="gone"             
           />

My problem is when the user selects an item of the list. I want to show the element details in another activity, show I start a new activity. But before the "details" actitity is shown, the elements of the list disappear, and the message "No elements found" is shown.

What could I do?

Thanks

4

0 回答 0