IT. Expert System.

Android Reference

TaskStackBuilder


android.support.v4.app

Class TaskStackBuilder

  • All Implemented Interfaces:
    Iterable<Intent>


    public class TaskStackBuilder
    extends Object
    implements Iterable<Intent>
    Utility class for constructing synthetic back stacks for cross-task navigation on Android 3.0 and newer.

    In API level 11 (Android 3.0/Honeycomb) the recommended conventions for app navigation using the back key changed. The back key's behavior is local to the current task and does not capture navigation across different tasks. Navigating across tasks and easily reaching the previous task is accomplished through the "recents" UI, accessible through the software-provided Recents key on the navigation or system bar. On devices with the older hardware button configuration the recents UI can be accessed with a long press on the Home key.

    When crossing from one task stack to another post-Android 3.0, the application should synthesize a back stack/history for the new task so that the user may navigate out of the new task and back to the Launcher by repeated presses of the back key. Back key presses should not navigate across task stacks.

    TaskStackBuilder provides a backward-compatible way to obey the correct conventions around cross-task navigation on the device's version of the platform. On devices running Android 3.0 or newer, calls to the startActivities() method or sending the PendingIntent generated by getPendingIntent(int, int) will construct the synthetic back stack as prescribed. On devices running older versions of the platform, these same calls will invoke the topmost activity in the supplied stack, ignoring the rest of the synthetic stack and allowing the back key to navigate back to the previous task.

    About Navigation

    For more detailed information about tasks, the back stack, and navigation design guidelines, please read Tasks and Back Stack from the developer guide and Navigation from the design guide.
    • Method Detail

      • create

        public static TaskStackBuilder create(Context context)
        Return a new TaskStackBuilder for launching a fresh task stack consisting of a series of activities.
        Parameters:
        context - The context that will launch the new task stack or generate a PendingIntent
        Returns:
        A new TaskStackBuilder
      • from

        public static TaskStackBuilder from(Context context)
        Deprecated. use create(Context) instead
        Return a new TaskStackBuilder for launching a fresh task stack consisting of a series of activities.
        Parameters:
        context - The context that will launch the new task stack or generate a PendingIntent
        Returns:
        A new TaskStackBuilder
      • addNextIntent

        public TaskStackBuilder addNextIntent(Intent nextIntent)
        Add a new Intent to the task stack. The most recently added Intent will invoke the Activity at the top of the final task stack.
        Parameters:
        nextIntent - Intent for the next Activity in the synthesized task stack
        Returns:
        This TaskStackBuilder for method chaining
      • addNextIntentWithParentStack

        public TaskStackBuilder addNextIntentWithParentStack(Intent nextIntent)
        Add a new Intent with the resolved chain of parents for the target activity to the task stack.

        This is equivalent to calling addParentStack with the resolved ComponentName of nextIntent (if it can be resolved), followed by addNextIntent with nextIntent.

        Parameters:
        nextIntent - Intent for the topmost Activity in the synthesized task stack. Its chain of parents as specified in the manifest will be added.
        Returns:
        This TaskStackBuilder for method chaining.
      • addParentStack

        public TaskStackBuilder addParentStack(Activity sourceActivity)
        Add the activity parent chain as specified by manifest <meta-data> elements to the task stack builder.
        Parameters:
        sourceActivity - All parents of this activity will be added
        Returns:
        This TaskStackBuilder for method chaining
      • addParentStack

        public TaskStackBuilder addParentStack(Class<?> sourceActivityClass)
        Add the activity parent chain as specified by manifest <meta-data> elements to the task stack builder.
        Parameters:
        sourceActivityClass - All parents of this activity will be added
        Returns:
        This TaskStackBuilder for method chaining
      • addParentStack

        public TaskStackBuilder addParentStack(ComponentName sourceActivityName)
        Add the activity parent chain as specified by manifest <meta-data> elements to the task stack builder.
        Parameters:
        sourceActivityName - Must specify an Activity component. All parents of this activity will be added
        Returns:
        This TaskStackBuilder for method chaining
      • getIntentCount

        public int getIntentCount()
        Returns:
        the number of intents added so far.
      • getIntent

        public Intent getIntent(int index)
        Deprecated. Renamed to editIntentAt to better reflect intended usage
        Get the intent at the specified index. Useful if you need to modify the flags or extras of an intent that was previously added, for example with addParentStack(Activity).
        Parameters:
        index - Index from 0-getIntentCount()
        Returns:
        the intent at position index
      • editIntentAt

        public Intent editIntentAt(int index)
        Return the intent at the specified index for modification. Useful if you need to modify the flags or extras of an intent that was previously added, for example with addParentStack(Activity).
        Parameters:
        index - Index from 0-getIntentCount()
        Returns:
        the intent at position index
      • iterator

        public Iterator<Intent> iterator()
        Deprecated. Use editIntentAt instead
        Description copied from interface: Iterable
        Returns an Iterator for the elements in this object.
        Specified by:
        iterator in interface Iterable<Intent>
        Returns:
        An Iterator instance.
      • startActivities

        public void startActivities()
        Start the task stack constructed by this builder. The Context used to obtain this builder must be an Activity.

        On devices that do not support API level 11 or higher the topmost activity will be started as a new task. On devices that do support API level 11 or higher the new task stack will be created in its entirety.

      • startActivities

        public void startActivities(Bundle options)
        Start the task stack constructed by this builder. The Context used to obtain this builder must be an Activity.

        On devices that do not support API level 11 or higher the topmost activity will be started as a new task. On devices that do support API level 11 or higher the new task stack will be created in its entirety.

        Parameters:
        options - Additional options for how the Activity should be started. See {@link android.content.Context#startActivity(Intent, Bundle)
      • getIntents

        public Intent[] getIntents()
        Return an array containing the intents added to this builder. The intent at the root of the task stack will appear as the first item in the array and the intent at the top of the stack will appear as the last item.
        Returns:
        An array containing the intents added to this builder.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 270 / 158691308. Delta: 0.04230 с