Sunday, October 2, 2011

Android Asset Folder

There seems to be a limit to the size of file you can read from if it placed in the assets folder in Android. Trying to read bytes from a file over 1MB results in an IOException.

Stackoverflow suggests splitting files into 1MB chunks (or giving the file an extension such as .mp3 - i.e. already compressed), and that the problem is due to Android compressing files in the assets folder when they're above a certain size.

Saturday, October 1, 2011

Ignoring Case in SQLite Android Queries

Instead of using the "=?" string to match strings exactly, use "like?":

    db.query(TABLE_NAME, COLUMNS, REG_COLUMN + " LIKE? ", new String[] {searchQuery}, null, null, null);

instead of:

    db.query(TABLE_NAME, COLUMNS, REG_COLUMN + "=? ", new String[] {searchQuery}, null, null, null);