Monday, July 12, 2010

Android Dev Tips

Tip 1: Import a sqlite DB from somewhere else (let us say db.sqlite)
tools$ ./adb push ~/android/db.sqlite /data/data/test.app/databases
1934 KB/s (443392 bytes in 0.223s)

Tip2:
While Activity.setContentView takes an id of a Layout, TabSpec.setContent takes an id of a View.

Tip 3: Android: Get the Application Version in an activity
PackageInfo info = getPackageManager().getPackageInfo( getPackageName(), 0 );
String version = info.versionName;

Tip 4: Android onNewIntent() is never called.

In the android manifest file for the activity, add the following attribute
android:launchMode="singleInstance"

No comments: