This is an easy question but I am not sure the correct jargon to use, so google isn’t giving me the result that I want.
I am new to android and have written a few basic application and wanted to make another basic app that has displays information. So it would several main topics and then you can click on one and it will display another list of topics related to the main category and then finally the information.
I am having trouble because I’m unsure whether to just make a bunch of different xml layouts for each category or if I can use an SQL database to store all my data and have the menus point to it. From what I’ve read SQL seems to be used more when you want to store data vs access it but again i’m new to this. So what would be the best way to approach this.
I just want the layout to be scroll view with a table of 1 column and as many rows I need for the particular topic.
Sorry again I know there is probably a million examples via google but I don’t know how to word my question.
Thanks!
If I am reading it correctly, you are looking to create dynamic content from a DB table to fill a view with a list. And the onClick for each list item will open up another list of topics (sub topics / articles in that topic). A click on that sub-topic list item will open up some content.
What you are looking for is the ListView ( http://developer.android.com/resources/tutorials/views/hello-listview.html ). This takes an array of data and a layout that will be rendered with it. It’s pretty straightforward.
However, if you are pulling from a DB then a better adapter would be the SimpleCursorAdapter which is designed to show DB rows in a list view (http://developer.android.com/reference/android/widget/SimpleCursorAdapter.html ). I dont think it could be better explained than here Getting stored data from database into ListView..
You can reuse the class that displays the adapter by having the item onClick open the same activity but passing in filter params through the bundle that will use to filter the DB results, depending on what you want.