3 回答

TA貢獻(xiàn)1906條經(jīng)驗(yàn) 獲得超10個(gè)贊
如果您的Android版本低于Android-6,則需要添加此行,否則它將在Android-6以上運(yùn)行。
...
Intent i = new Intent(this, Wakeup.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
...

TA貢獻(xiàn)1813條經(jīng)驗(yàn) 獲得超2個(gè)贊
對于同一活動的多個(gè)實(shí)例,請使用以下代碼段,
注意:此代碼段是我在之外使用的Activity。確保您的AndroidManifest文件不包含android:launchMode="singleTop|singleInstance"。如果需要,可以將其更改為android:launchMode="standard"。
Intent i = new Intent().setClass(mActivity.getApplication(), TestUserProfileScreenActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
// Launch the new activity and add the additional flags to the intent
mActivity.getApplication().startActivity(i);
這對我來說很好。希望這可以為某人節(jié)省時(shí)間。如果有人找到更好的方法,請與我們分享。
- 3 回答
- 0 關(guān)注
- 813 瀏覽
添加回答
舉報(bào)