My application uses a Multi Pane layout to display a list of assignments. Each Assignment
can be put in one AssignmentCategory
. I want to use a DrawerLayout to display all the AssignmentCategories so the user can switch easily between the diffirent categories.
I didn't manage to create such a layout. In the official DrawerLayout tutorial the DrawerLayoutActivity replaces a Fragment
when a user clicks on a item (in my case an AssignmentCategory
). The problem I facing is that a Multi Pane layout requires a FragmentActivity
. I don't know how to create a Fragment
which contains a Multi Pane layout. Did someone manage to do this?
Combining the two projects shouldn't be too difficult. In the sample code the
DrawerLayout
example does replace the content fragment but you don't have to do the same, you could simply update the same fragment to show the proper data. You could implement the two projects this way:ActionBarActivity
(v7), you don't need to extendFragmentActivity
DrawerLayout
(the sample code from the drawer project) code in the start list activity(I'm assuming you don't want theDrawerLayout
in the details activity, but implementing it shouldn't be a problem if you want it).the layout of the start list activity will be like this(don't forget that you need to implement the
DrawerLayout
changes in theactivity_item_twopane.xml
as well!):change the implementation
DrawerItemClickListener
so when the user clicks the drawer list item you don't create and add a new list fragment, instead you update the single list fragment from the layout:the update method would be something like this:
-various other small changes
I've made a sample project to illustrate the above changes that you can find here.