3

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

Steve B
  • 31
  • 1
  • 4
  • I think [this](http://stackoverflow.com/questions/22089033/drill-down-navigation-with-fragments-from-navigationdrawer) will answer your question. – Liangjun May 10 '14 at 00:30
  • this Q& A will answer your question. http://stackoverflow.com/questions/22089033/drill-down-navigation-with-fragments-from-navigationdrawer – Liangjun May 10 '14 at 01:34

1 Answers1

1

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.

Xaver Kapeller
  • 49,491
  • 11
  • 98
  • 86
  • This sounds great. I'm assuming this would this still be done within the Navigation Drawer. I will do some studying and try to post some code within the next day or so, as I'm sure my first attempt will need some fine tuning. – Steve B Apr 05 '14 at 23:30
  • 1
    Ok, here is where I am so far. I am downloading a database from the web, using Marco's code from: [link](http://stackoverflow.com/questions/10254872/download-sqlite-database-from-internet-and-load-into-android-application) . But I can't even get a regular listview to populate. Since every person's code seems to be so different, it is very difficult to learn where to put things. – Steve B May 12 '14 at 22:08
  • I assume you already look through those, but in my opinion the official guides from Google are the best to learn Android. You can find literally everything you need to know there and it's not just about programming. On one side you have detailed design guides like [this](https://developer.android.com/design/patterns/navigation-drawer.html) and [here](http://developer.android.com/training/implementing-navigation/nav-drawer.html) is a guide on how to implement the same thing. I read all of the design guides and developer guides when I got started and it really helped me out. – Xaver Kapeller May 13 '14 at 13:21
  • [Link to the start of the design guides](https://developer.android.com/design/index.html), [Link to the start of the developer guides](http://developer.android.com/training/index.html). Just to clarify when I say design than I don't mean purely the styling and the graphics but how to build a mobile UI, when to use certain controls and patterns etc. – Xaver Kapeller May 13 '14 at 13:23
  • Thanks Xavaer! I will definitely need to spend some time getting myself up to speed. I have gotten my problem down to one cursor call, but I think I should start a new thread that is very specific to that problem. I'm confident it is a very simple fix, but then again, everything is easy after you know how. – Steve B May 13 '14 at 20:52
  • Here is the link to new, more specific question: [LINK](http://stackoverflow.com/questions/23641848/beginner-having-trouble-populating-a-listview-from-a-downloaded-database-in-an) – Steve B May 13 '14 at 21:26