bakua
bakua

Reputation: 14474

How can I possibly create DialogFragment from ListActivity on Android?

I have an application with main activity extending ListActivity and displaying bunch of items. And I'd like to show a custom DialogFragment after clicking on list's item (for edit item info). But according to Google's android tutorial http://developer.android.com/guide/topics/ui/dialogs.html I can show DialogFragment only from activity that extends FragmentActivity because there is need to call getSupportFragmentManager() method.

So question is: how do I show custom dialog from ListActivity?

Thanks :)

Upvotes: 5

Views: 1599

Answers (1)

toadzky
toadzky

Reputation: 3846

I would probably just extend FragmentActivity to replicate the stuff in ListActivity. You can default the content view to a list view (with an empty view if needed), and recreate the methods getListView, getListAdapter, and onListItemClick. Then you get all the fragment stuff and it acts like a regular list activity.

Upvotes: 4

Related Questions