wesley tanaka


Query the COUNT of rows in a SQLite table in Android


There's a function DatabaseUtils.queryNumEntries() which can be used to query SELECT COUNT(*) FROM table; in a SQLite database in Android.

java.lang.VerifyError: com.google.analytics.tracking.android.AppFieldsDefaultProvider


The Google Analytics SDK for Android v3 (Beta) does not support Android 1.5 (API version 3).  When you try to call EasyTracker.getInstance(this).activityStart(this); you will get this error:

java.lang.IllegalStateException: attempt to acquire a reference on a close SQLiteClosable


"java.lang.IllegalStateException: attempt to acquire a reference on a close SQLiteClosable" can occur in an Android program if you try to do an operation (like run a .query()) on a SQLiteDatabase object which has already been

Regression testing sqlite database migrations in Android


One strategy to test Android sqlite database upgrades is to make a copy of your SQLiteOpenHelper class each time you create a new database version. That way, you can use the older revisions of SQLiteOpenHelper to create legacy versions of your database schema and make sure that when you open the database with newer versions, the upgrade works properly.

3D models from a single photo


Drop, modify, change or rename a column from a SQLite table in Android


SQLite only supports a limited subset of ALTER TABLE, so to modify an existing column, it's necessary to create a separate table. The SQLite documentation recommends doing two separate INSERT/SELECT operations using a temporary table, instead of doing an INSERT/SELECT followed by an ALTER TABLE RENAME TO.

Running a SQLite database transaction in Android


The idiom for SQLite transactions in Android is:

try {
  // Do database operations here ...
} finally {

Responsive AdSense Leaderboard ad unit for Twitter Bootstrap 2.3.2


Twitter Bootstrap 2.3.2 sets its media query responsive layout breaks at 768px, 980px, (and 1200px), which are suitable for including a Mobile Banner (320 x 50), Leaderboard (728 x 90), or a  Large Leaderboard (970 x 90). It's possible to do this with the new beta Responsive ad unit AdSense ad size.

java.lang.IllegalArgumentException: transactions on multiple entity groups only allowed in High Replication applications


If you run a Java Google App Engine unit test with a vanilla LocalDatastoreServiceTestConfig instance, you will run into the error java.lang.IllegalArgumentException: transactions on multiple entity groups only allowed in High Replication applications:

Keys-only query using JDO in Google App Engine Java


To turn a Java Google App Engine JDO query into a keys-only query, call setResult(String) on it to specify that only the @PrimaryKey column should be returned.  JDO will convert this into a keys-only query on the datastore.

For example, if your entity class looks like this:

public class YourEntity {
  private String name;
// ...

Syndicate content
by Wesley Tanaka