I'm working on an ListActivity app with only one table:
- commands
- _id
- name
- url
- ...
So far Success/Failure flag is added "on the fly" and responses are not stored. If I restart my app or change orientation, responses are cleared. Moreover I'd like to be able to retrieve all past responses for a specific command with a new activity.
I'm thinking of adding a second table where storing responses:
- responses
- _id
- command_id (foreign key)
- success (true/false)
- ...
At the moment I use a really simple POJO (I'll add setters and getters asap):
public class Command {
public long id;
public String name;
public String server;
public String url;
}
My CustomAdapter
is currently working with a ArrayList<Command>
. I'm thinking of subclassing Command
adding the fields I would like to show on my ListView
(success/failure flag, Date when command sent) that will be retrieved with a join select between commands and responses tables.
Command
s and Response
s will have separate DataSource
s classes for opening/closing the db, inserting, editing, removing and selecting. CustomAdapter
will work on the new subclass of Command
.
What do you think?
Aucun commentaire:
Enregistrer un commentaire