lundi 2 février 2015

Displaying an ArrayList Passed by a database cursor over an Android Layout

I am building an application that requires querying a database and displaying the info, all the rows, in a tabular format. Think about a class that alters the view based on the arrayList passed.



public void showTable(ArrayList<Item> levelData)
{
//someCode to alter a tablieView or something.
}


The DataStructure:



public class Item
{
public
String siteID,
activityID,
activityName,
levelID,
levelName,
noOfAct,
noOfLevel,
pic_url;
int numlevs;
public Item()
{

}

}


Since the query's results are dynamic in nature, I need to edit the layout with java in the activity. I believe there are 2 approaches to this, One is when I can just display the things in a Table View, or use a linear layout and Add Buttons onto it so that the User can click on a piece of information to reveal more data, in another layout perhaps.


I need answers about how this can be done.


Are there are any Open classes available to display data from a cursor (or an ArrayList), detecting the columns in the database?


Aucun commentaire:

Enregistrer un commentaire