2
What would be the best practices in relation to sqlite on Android? I use a single db Contract for all tables (each table a class within the main class Contract)?
public final class FeedReaderContract {
// To prevent someone from accidentally instantiating the contract class,
// make the constructor private.
private FeedReaderContract() {}
/* Inner class that defines the table contents */
public static class FeedEntry implements BaseColumns {
public static final String TABLE_NAME = "entry";
public static final String COLUMN_NAME_TITLE = "title";
public static final String COLUMN_NAME_SUBTITLE = "subtitle";
}
public static class OutraTabela implements BaseColumns {
....
}
}
Or I create a Contract class for each table?
in the case I have 12 tables (which are many), I was confused, because in the google documentations, it does not say if I should put all tables in the same class Tract, I thought so.. There are 12 tables, IE, 12 files, would not get messy?
– felipe.rce
There is no direction for this in practice. 12 tables is little, because you are only creating constants in the classes and a few methods. I would put everything in one. But it is to the taste of the customer, rs, the important is also not to "organize" too much and make it difficult to read.
– Márcio Oliveira