Reputation: 1455
I'm making an app for android that requires me to log the results and input parameters. My problem is that I don't know how to make efficient software to accomplish this. Unfortunately I can't use a database, because the device doesn't have access to internet, so I have to save my files locally. There is about 10 parameters per log, and it should be fast to search by each and one of them. Also I want avoid files that are too big.
This is the first time I'm coding something like this as a college hobbyist, so I don't have much experience in this field. That's why i was hoping i could get some pointers on how to implement it, or some classes that already handle this kind of task.
Upvotes: 0
Views: 66
Reputation: 2528
Of course you can use a database! Android supplies the ability to create locally-stored SQLite databases just for this very purpose.
Example taken from Storage Options | Android Developers:
public class DictionaryOpenHelper extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 2;
private static final String DICTIONARY_TABLE_NAME = "dictionary";
private static final String DICTIONARY_TABLE_CREATE =
"CREATE TABLE " + DICTIONARY_TABLE_NAME + " (" +
KEY_WORD + " TEXT, " +
KEY_DEFINITION + " TEXT);";
DictionaryOpenHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(DICTIONARY_TABLE_CREATE);
}
}
Upvotes: 1