dimanche 24 janvier 2016

Android dynamic button navigation from sqlite

I am making an Android application presenting bus times retrieved from an sqlite database. I am struggling to dynamically create buttons that implement a navigation system to access certain information. For instance:

Route -> Weekday -> Bus Stop -> Time

Where each '->' represents a button click taking the user through a tree. I could put all of these buttons in XML, but the end goal involves more than 100 buttons, which would be nightmare to code. Is there a way for me to create buttons based on a button click? Ex. I would click the "Route" button which would query the sqlite database and generate the appropriate "Weekday" buttons.

Would this be the case for a custom adapter, or using the Button.setTag() method, or something with onClickListener()? Any help is appreciated!

Aucun commentaire:

Enregistrer un commentaire