简体   繁体   English

Android在主屏幕启动器上调用onNewIntent()

[英]Android call onNewIntent() of homescreen launcher

I learned that the Android launcher resets the homescreen to the default page when onNewIntent() is called. 我了解到,在调用onNewIntent()时,Android启动器会将主屏幕重置为默认页面。 I know that onNewIntent() is called when the activity receives another start intent while it's already in the foreground. 我知道当活动已经在前台时又收到另一个启动意图时,就会调用onNewIntent()。 Is there a way to call the onNewIntent() of the activity when it's in the background? 当活动处于后台时,是否可以调用该活动的onNewIntent()?

I have tried several flags like FLAG_ACTIVITY_CLEAR_TOP, FLAG_ACTIVITY_SINGLE_TOP and FLAG_ACTIVITY_REORDER_TO_FRONT but none seems to call onNewIntent. 我已经尝试了多个标志,例如FLAG_ACTIVITY_CLEAR_TOP,FLAG_ACTIVITY_SINGLE_TOP和FLAG_ACTIVITY_REORDER_TO_FRONT,但似乎没有一个调用onNewIntent。

Any help would be appreciated 任何帮助,将不胜感激

Try this, It will Help You, 试试这个,它将为您提供帮助,

Intent intent = new Intent(MainActivity.this, TargetActivity.class);
intent.setAction(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MainActivity.startActivity(intent);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM