I have an SQL database that I am dynamically adding rows and columns to.
I want to display the data in the SQL database onto a ListView of LinearLayouts, but since the rows and columns are growing and shrinking dynamically, I am going to need to build the layout dynamically in my code.
Is there a way to use a SimpleCursorAdapter to map the data into my layout? Or can the SimpleCursorAdapter only be used on statically defined XML layouts?
I have an SQL database that I am dynamically adding rows and columns to.
Um, OK.
I want to display the data in the SQL database onto a ListView of LinearLayouts
Unless you have limits on the number of columns, this may be difficult.
Is there a way to use a SimpleCursorAdapter to map the data into my layout?
Only if there is a reasonable maximum number of columns. In that case, as @Maximus suggests, you can hide unused columns using View.GONE
. Otherwise, you are better served using CursorAdapter
and overriding newView()
and bindView()
accordingly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.