ListActivity is an activity that displays a list of items by binding to a data source such as an array or Cursor, and exposes event handlers when the user selects an item. We make the class extend ListActivity instead of Activity. We'll create a scrollable list of country names that are read from a string array. If we want to customize the layout, ListActivity knows which widget is the main list for the activity as long as we identify our ListView as let's work on real list example. If main view is just the list, we do not even need to supply a layout ListActivity will construct a full-screen list for us. The list items are automatically inserted to the list using a ListAdapter, and we use attached listener via setOnItemSelectedListener() to find out when the selection has changed.īut, if our activity is dominated by a single list, we might consider creating our activity as a subclass of ListActivity, rather than the regular Activity class. ListView is a ViewGroup that creates a list of scrollable items. Android provides the view ListView for this. The user gets a list of items that can be scrolled.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |