Inflating different xml layouts in an Android ListView for different Objects.

While working on the Ambient Dynamix Project, I needed to create a listview which contains a non fixed number of headers each one followed by some list items. A common solution is to use the MergeAdapter. A MergeAdapter object exposes the addAdapter(), addView() and addViews() methods. The demo included in the repo is pretty self… Continue reading Inflating different xml layouts in an Android ListView for different Objects.

Hiding a list item from an Android ListView without removing it from the data source.

Ideally when I have to remove a list item from a listview, I’d remove the data object from the collection which the adapter uses and then do a adapter.notifyDataSetChanged() call which’ll redraw the list view. Consider an adapter which uses an array list of Strings. Now, to delete an item from the ListView, But this… Continue reading Hiding a list item from an Android ListView without removing it from the data source.