Android: Remove data from list and add new list
I have lot of lists: for example: Categories, and subCategories, in my case some Categories has subcategories,
So What I want to do, is if the categories has subcategories I want to clean the recently list and show the subcategories,
(This can be solved by creating new activity for only subcategories, but I would say that the most of the code woyld same)
I wounder how can I updoate list whit new data? If possible to add some animation when clicking, so the list goes to left when clicki开发者_如何学编程ng, and showing data comes from right,
I can think of two ways
You can extend PreferenceActivity or ListActivity and dynamically change the list items (If they are static just use the preference activity, it will do animation for you)
It is always possible to replace the current adapter of the list, but i have no idea on how to animate when you replace the adapter
listview.setAdapter(your_new_adapter);
listview.notifyDataDetChanged();
精彩评论