Reputation: 31
I know EXACTLY what I want to do, but am new to android programming. I have gone through countless tutorials and searched everywhere, but cannot find any code examples of how to use multiple listviews (or other method, if there's a better way) in Navigation Drawer to achieve a true multi-level drill-down menu. I'm talking 4 or maybe even 5 levels of hierarchy. Expandable listview will NOT work for me. The BEST explanation I can find is the "Dropbox" example located here: http://www.androidpatterns.com/uap_pattern/drill-down-navigation
Let's assume this is for a product catalog. So listview #1 would have options like Computers, Appliances, Video, Audio. Listview #2 would re-populate the NavDrawer list with options like Stereos, Speakers, Cables (assuming they select Audio), Listview #3 would re-populate list with Sony, Yamaha, Etc. (assuming they select Stereos), and the final listview #4 would list all Sony stereos. When they make their selection, it would query the database and display the fragment view of that particular stereo.
I think I can handle all the database code. What's really holding me up is simply the functionality of the navigation. I am a very visual learner, so any actual code examples or tutorials you can point me to would be invaluable. Thank you in advance for any help! :)
Upvotes: 3
Views: 2027
Reputation: 49817
I would implement it with Fragments
. For every level in your hierarchy you create a ListFragment
and if a user clicks on an item in the list you perform a FragmentTransaction
and replace the current Fragment
with the next one. I assume you know how to implement a ListFragment
, if not I can explain it to you. I'm not sure what code samples to give you aside from just posting a completely implemented ListFragment
as this is not really a very specific question. Perhaps I can help you further if you explain what you have tried so far or if you post some relevant code.
Upvotes: 1