Android tabluar data from database
I want to show all the data from the database in a View. addview
to the layout is a good idea. But as I don't know the no. of data, I cann't create required no. of textview, and i cann't add a single textview multiple number of time. How can I solve this prob开发者_如何学运维lem?
But as I don't know the no. of data, I cann't create required no. of textview, and i cann't add a single textview multiple number of time.
You don't need to create TextView
multiple times, it would lead to more complex application.
Rather I would suggest you shold create a simple or custom ListView
using simple or custom ArrayAdapter or BaseAdapter or CursorAdapter
accordingly your needs.
Refer this: Getting Stored Data from my Database into ListView
Just read this article to learn how to get info from the database using CRUD methodology: http://knightswhocode.com/wordpress/?p=14 Create a list of items taken from the database. Then create a ListView with adapter using this list.
精彩评论