Launch Stock Apps using Intent

Some time we have to launch stock applications in our android phone without need of performing some action. Like Email, Browser,Calculator,Calendar, Contacts, Gallery, Market and so on. This can be done by using power full function makeMainSelectorActivity() method of Intent class.

Syntax is pretty simple, just to write few lines of code

Say you want to open email app.
Intent intent= Intent.makeMainSelectorActivity(Intent.ACTION_MAIN, Intent.CATEGORY_APP_EMAIL);
startActivity(intent);

For other apps you just have to replace second parameter i.e. category.

Here is some app listed category from android developer refernce

You can explore more to android docs for understanding power of Intents.
https://developer.android.com/reference/android/content/Intent.html#CATEGORY_ALTERNATIVE


Comments

Popular posts from this blog

Software Design Principles (SOLID)

Draw Over Screen App Example Android

Sync Adapter Overview