Not start MainActivity with android 2.3

后端 未结 2 1994
自闭症患者
自闭症患者 2021-01-28 09:14

I want to start my MainActivity, in android 2.3, it will not start, but in Jelly Bean it works. I get no error, nothing happens!

I\'ve noticed when I use putExtra, then

2条回答
  •  Happy的楠姐
    2021-01-28 09:28

    Might want to give this a try:

        Intent intent = new Intent("android.intent.action.MAIN");
        intent.addCategory("android.intent.category.LAUNCHER");
        intent.setComponent(new ComponentName("de.application.ui", "de.application.ui.MainActivity"));
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.putExtra("de.application.exit", true);
        startActivity(intent);
    

提交回复
热议问题