Example usage for android.support.v4.content ContextCompat startActivities

List of usage examples for android.support.v4.content ContextCompat startActivities

Introduction

In this page you can find the example usage for android.support.v4.content ContextCompat startActivities.

Prototype

public static boolean startActivities(Context context, Intent[] intentArr, Bundle bundle) 

Source Link

Usage

From source file:com.samelody.stara.ContextStarter.java

@Override
protected void startActivities(Context starter, Intent[] intents, Bundle options) {
    ContextCompat.startActivities(starter, intents, options);
}

From source file:com.wujilin.doorbell.starter.ContextStarter.java

@Override
public void startActivities(Context starter, Intent[] intents, Bundle options) {
    ContextCompat.startActivities(starter, intents, options);
}

From source file:net.lp.actionbarpoirot.helpers.DualTaskStackBuilder.java

/**
 * Start the task stack constructed by this builder. The Context used to
 * obtain this builder must be an Activity.
 * //w  w  w.jav  a 2  s  .  c  o  m
 * <p>
 * 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.
 * </p>
 * 
 * @param options
 *            Additional options for how the Activity should be started. See
 *            {@link android.content.Context#startActivity(Intent, Bundle)
        
 */
public void startActivities(Bundle options) {
    if (mIntents.isEmpty()) {
        throw new IllegalStateException("No intents added to DualTaskStackBuilder; cannot startActivities");
    }

    Intent[] intents = mIntents.toArray(new Intent[mIntents.size()]);
    intents[0] = new Intent(intents[0]).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
            | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK | IntentCompat.FLAG_ACTIVITY_TASK_ON_HOME);
    if (!ContextCompat.startActivities(mSourceContext, intents, options)) {
        Intent topIntent = new Intent(intents[intents.length - 1]);
        topIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        mSourceContext.startActivity(topIntent);
    }
}