开发者

Loading a standard layout into a ListActivity

开发者 https://www.devze.com 2023-04-11 13:59 出处:网络
I\'d like my App to show a warning message if there are no elements to load on a ListActivity; so I thought to write this on the onResume event:

I'd like my App to show a warning message if there are no elements to load on a ListActivity; so I thought to write this on the onResume event:

if(elementsToLoad.size()==0) setContentView (alternative layout); else loadList();

but it crashes..开发者_StackOverflow.How could I fix this?


You can use an empty view. See setEmptyView(View emptyView) method from ListView. Or you can add view to your layout with id @android:id/empty and ListView will show it for you, if list is empty.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号