How to Launch Home Screen Programmatically in Android

sjor picture sjor · Jan 21, 2011 · Viewed 44.8k times · Source

I want to launch home screen of Android with my application. The main target is to show all of apps to user when he/she presses a specialized key. Actually, the way is not important. Any idea to do this?

Answer

Anand picture Anand · Jan 21, 2011

Here is the code for starting HomeActivity

        Intent startMain = new Intent(Intent.ACTION_MAIN);
        startMain.addCategory(Intent.CATEGORY_HOME);
        startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(startMain);