Reputation:
A list activity class extends ListActivity for creating list menu. As java doesn't allow multiple inheritance and a fragment class already extends Fragment than how can i make a list menu in a fragment? or there is an alternative method for doing so?
Thanks in advance.
Upvotes: 1
Views: 2300
Reputation: 189
You simply add a listView in your fragment layout file and use it in your fragment class. the method you are using is quite old.
Upvotes: 0
Reputation: 29285
Alternative to ListFragment
, you can create your own ListView
within an empty Fragment
.
Tutorial: Create a simple ListView.
Upvotes: 0
Reputation: 33398
You should use ListFragment instead of Fragment
A fragment 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.
Here is a simple tutorial to show how it is used.
Upvotes: 0
Reputation: 793
I believe you can just use an activity and use a ListFragment and in onActivityCreated(Bundle b)
, just do the following:
setHasOptionsMenu(true)
. Maybe I'm not understanding your question otherwise... No need for that multiple inheritance complication.
Upvotes: 1