Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 :)

like image 907
bakua Avatar asked Oct 07 '22 06:10

bakua


1 Answers

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.

like image 123
toadzky Avatar answered Oct 10 '22 02:10

toadzky