Showing posts from June, 2011

Launching third party application through Intent

The snippet for launching a third party application through intent is,

Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName("com.smartandroidians", "com.smartandroidians.NotificationWithAction");

The first parameter in setClassName() is the package name and the second parameter is the launcher activity class name

Cursor management in Honeycomb

If you are targeting your application for honeycomb, then some APIs related to cursor management are deprecated and your application won't work smoothly in honeycomb, eventhough it will work well in other versions of Android. In Honeycomb, cursor management is more tightly coupled and Some of the APIs that are deprecated are

- startManagingCursor()
- stopManagingCursor()
- managedQuery()
- reQuery()

If you are using any of these methods in HoneyComb, then you will get an exception, like

java.lang.IllegalStateException: trying to requery an already closed cursor

If you are using managedQuery() in lower versions of Android(2.3,2.2) as,

cursor = context.managedQuery(android.provider.Browser.BOOKMARKS_URI, projection, null, null,

then in Honeycomb you need to modify as,

CursorLoader cursorLoader = new CursorLoader(context, android.provider.Browser.BOOKMARKS_URI, projection, null, null,
cursor = cursorLoader .loadInBack…