Calling StartActivity () from outside of an Activity context requires the Flag_activity_new_task FLA

Source: Internet
Author: User

You need to use Flag_activity_new_task to pull out another activity from an activity by intent.
Otherwise, there will be force close:
03-01 18:49:37.888 E/androidruntime (2706): FATAL exception:main
03-01 18:49:37.888 E/androidruntime (2706): Android.util.AndroidRuntimeException:Calling startactivity () from outside Of an Activity context requires the Flag_activity_new_task FLAG. Is this really what do you want?

Flag_activity_exclude_from_recents:

If the activtivity is only a functional fragment, and there is no practical meaning, there is no need to appear in the long Press home button to bring up the most recently used Program Class table, then use flag_activity_exclude_from_recents

Intent Intent = new Intent (this, waitingfallbackdialog.class);
Intent.setflags (Intent.flag_activity_new_task | intent.flag_activity_exclude_from_recents);
StartActivity (Intent);

Calling StartActivity () from outside of an Activity context requires the Flag_activity_new_task FLA

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.