Reputation: 1923
Ok, I have a database with id column as timestamp I made an activity list from the db. I want to manage the db (delete rows) using the list, but the thing is I don't want to View the whole timestamp, in every row I'll put only the time with some info and I want to group the list ,as in contacts grouped by alphabet, by the date.
First, how can I make group in an activity list? (Making groups to the output list not the db) Second, what is the best way to implement this? When user chooses an item and confims delete I should delete it from the db but I have only patial timestamp... (My only link to the db is the timestamp - I don't actually know where to store it in the list and I don't want to put it as a string in the text view, do a substring to get it back - is there another way to do this?)
I tried to search tthe web for some examples but I only found a simple ones.
Thnx :-)
Upvotes: 1
Views: 178
Reputation: 1923
http://www.vogella.com/articles/AndroidListView/article.html
I should use cursor adapter for managing db.
And this one for grouping a list: http://code.google.com/p/android-amazing-listview/
Thnx for the efforts
Upvotes: 0
Reputation: 8641
?
I think what you're trying to do is create a database of tasks identified by a timestamp. You probably don't want to use a timestamp as a unique ID for the row. Instead, use an integer and qualify it as "PRIMARY KEY" when you create the database.
group the list? I'm not sure why you want to do this in the structure of the database. It's more common to group the list in the output, and leave the db itself in as flat a structure as possible.
Retrieve the primary key when you display a list of tasks. When the user clicks a task, use the primary key to choose the task to delete. You don't have to display the primary key; it serves as a behind-the-scenes "link" between the displayed info and the db row.
Upvotes: 1