[Android] Activity re-use

Source: Internet
Author: User

    • Intent Intent = new Intent (A. This, B.class);
    • Intent.setflags (Intent.flag_activity_reorder_to_front | Intent.flag_activity_previous_is_top);

Intent.flag_activity_reorder_to_front:

If set Context.startActivity() in a Intent passed to, this flag would cause the launched activity to being brought to the front of its task ' s h Istory Stack If it is already running.

For example, consider a task consisting of four activities:a, B, C, D. If D calls StartActivity () with an Intent that res Olves to the component of activity B, then B'll be brought to the front of the "history" stack, with this resulting order: A, C, D, B. This flag would be ignored if is FLAG_ACTIVITY_CLEAR_TOP also specified.

When you turn on four activity A, B, C, D (no finish), if you want to startactivity B at D, then the system detects that B is already in the task stack and mentions B to the top of the stack, and the process is not new B.

[Android] Activity re-use

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.