Wednesday, July 01, 2009


Example of use of databse in Android Apps. code:

  public MyObject getEntry(long _rowIndex) {
    MyObject objectInstance = new MyObject();
    // TODO Return a cursor to a row from the database and
    // use the values to populate an instance of MyObject
    return objectInstance;
  }
  public int updateEntry(long _rowIndex, MyObject _myObject) {
    String where = KEY_ID + “=” + _rowIndex;
    ContentValues contentValues = new ContentValues();
    // TODO fill in the ContentValue based on the new object
    return db.update(DATABASE_TABLE, contentValues, where, null);
  }

No comments: