0

I want to bring the android default launcher on back button press, but I'm getting a dialog box style launcher. Also, I cannot call finish() because this is not my first activity and some of the previous activities are also not finished. Here is my code :

@Override
public void onBackPressed() {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_LAUNCHER);
    startActivity(intent);
}

android_launcher launcher_im_getting

sarabhai05
  • 578
  • 1
  • 4
  • 12

1 Answers1

0

try to remove this line from your code and run again

    intent.addCategory(Intent.CATEGORY_LAUNCHER);
Syn3sthete
  • 4,151
  • 3
  • 23
  • 41
  • no, it doesn't work. In that case it automatically takes category as CATEGORY_DEFAULT and again a dialog is showing – sarabhai05 Oct 08 '12 at 07:25
  • intent.setFlags(Intent."yourFlagName"); there are lot of flags to work with try if that could help you – Syn3sthete Oct 08 '12 at 07:32