I have a LoaderManager that is drawing data from two columns of a SQLite database. I would like to display the data in a table format in a fragment. I can get the data in a ListView or GridView, but cannot figure out the TableLayout. (Gridview has a setAdapter method, TableLayout doesn’t.)
I want the data to automatically update when the underlying database is updated through a service (hence the reason for the loaderManager.
I cannot find any information on how to implement what I’m looking for in any questions on this site or examples/tutorials on other sites.
TableLayout is a container that is supposed to be used statically, as well as LinearLayout, RelativeLayout, FrameLayout, etc. TableLayout is not an adapter view, that is, you can’t bind an adapter to it. I suggest you to use a ListView instead, or to build your TableLayout dynammically. Though, the ListView solution is smarter because it’s highly scalable, since it is scrollable and reuse views, optimizing layout performance by keeping less view instances around.