当前位置: 首页>>代码示例>>Java>>正文


Java TaskStackBuilder.startActivities方法代码示例

本文整理汇总了Java中android.support.v4.app.TaskStackBuilder.startActivities方法的典型用法代码示例。如果您正苦于以下问题:Java TaskStackBuilder.startActivities方法的具体用法?Java TaskStackBuilder.startActivities怎么用?Java TaskStackBuilder.startActivities使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.app.TaskStackBuilder的用法示例。


在下文中一共展示了TaskStackBuilder.startActivities方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    TaskStackBuilder builder = TaskStackBuilder.create(this);
    Intent proxyIntent = getIntent();
    if (!proxyIntent.hasExtra(EXTRA_INTENTS)) {
        finish();
        return;
    }

    for (Parcelable parcelable : proxyIntent.getParcelableArrayExtra(EXTRA_INTENTS)) {
        builder.addNextIntent((Intent) parcelable);
    }

    builder.startActivities();
    finish();
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:19,代码来源:TaskStackBuilderProxyActivity.java

示例2: onCreate

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    if (sharedPref.getBoolean(SettingsActivity.KEY_COLLECTE_ACTIVER, false)) {
        SharedPreferences.Editor editor = sharedPref.edit();
        editor.putBoolean(SettingsActivity.KEY_COLLECTE_ACTIVER, false);
        editor.commit();
    }

    TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
    stackBuilder.addNextIntent(new Intent(this, MainActivity.class));
    stackBuilder.addParentStack(MainActivity.class);

    stackBuilder.startActivities();
}
 
开发者ID:ANFR-France,项目名称:proto-collecte,代码行数:17,代码来源:StopCollecteActivity.java

示例3: navigateUpOrBack

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
/**
 * This utility method handles Up navigation intents by searching for a parent activity and
 * navigating there if defined. When using this for an activity make sure to define both the
 * native parentActivity as well as the AppCompat one when supporting API levels less than 16.
 * when the activity has a single parent activity. If the activity doesn't have a single parent
 * activity then don't define one and this method will use back button functionality. If "Up"
 * functionality is still desired for activities without parents then use
 * {@code syntheticParentActivity} to define one dynamically.
 *
 * Note: Up navigation intents are represented by a back arrow in the top left of the Toolbar
 *       in Material Design guidelines.
 *
 * @param currentActivity Activity in use when navigate Up action occurred.
 * @param syntheticParentActivity Parent activity to use when one is not already configured.
 */
public static void navigateUpOrBack(Activity currentActivity,
                                    Class<? extends Activity> syntheticParentActivity) {
    // Retrieve parent activity from AndroidManifest.
    Intent intent = NavUtils.getParentActivityIntent(currentActivity);

    // Synthesize the parent activity when a natural one doesn't exist.
    if (intent == null && syntheticParentActivity != null) {
        try {
            intent = NavUtils.getParentActivityIntent(currentActivity, syntheticParentActivity);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
    }

    if (intent == null) {
        // No parent defined in manifest. This indicates the activity may be used by
        // in multiple flows throughout the app and doesn't have a strict parent. In
        // this case the navigation up button should act in the same manner as the
        // back button. This will result in users being forwarded back to other
        // applications if currentActivity was invoked from another application.
        currentActivity.onBackPressed();
    } else {
        if (NavUtils.shouldUpRecreateTask(currentActivity, intent)) {
            // Need to synthesize a backstack since currentActivity was probably invoked by a
            // different app. The preserves the "Up" functionality within the app according to
            // the activity hierarchy defined in AndroidManifest.xml via parentActivity
            // attributes.
            TaskStackBuilder builder = TaskStackBuilder.create(currentActivity);
            builder.addNextIntentWithParentStack(intent);
            builder.startActivities();
        } else {
            // Navigate normally to the manifest defined "Up" activity.
            NavUtils.navigateUpTo(currentActivity, intent);
        }
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:52,代码来源:BaseActivity.java

示例4: onSupportNavigateUp

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
public boolean onSupportNavigateUp() {
    Intent upIntent = getSupportParentActivityIntent();
    if (upIntent == null) {
        return false;
    }
    if (supportShouldUpRecreateTask(upIntent)) {
        TaskStackBuilder b = TaskStackBuilder.create(this);
        onCreateSupportNavigateUpTaskStack(b);
        onPrepareSupportNavigateUpTaskStack(b);
        b.startActivities();
        try {
            ActivityCompat.finishAffinity(this);
        } catch (IllegalStateException e) {
            finish();
        }
    } else {
        supportNavigateUpTo(upIntent);
    }
    return true;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:AppCompatActivity.java

示例5: onClick

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
    // This ID represents the Home or Up button. In the case of this
    // activity, the Up button is shown. Use NavUtils to allow users
    // to navigate up one level in the application structure. For
    // more details, see the Navigation pattern on Android Design:
    //
    // http://developer.android.com/design/patterns/navigation.html#up-vs-back
    //
    final Intent listIntent = new Intent(this, PostItemListActivity.class);
    if (NavUtils.shouldUpRecreateTask(this, listIntent)) {
        final TaskStackBuilder taskStack = TaskStackBuilder.create(this);
        taskStack.addNextIntent(listIntent);
        taskStack.startActivities();
    } else {
        NavUtils.navigateUpTo(this, listIntent);
    }
}
 
开发者ID:MimiReader,项目名称:mimi-reader,代码行数:19,代码来源:PostItemDetailActivity.java

示例6: processDeepLink

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
private void processDeepLink() {
    Intent intent = getIntent();
    if (intent == null || intent.getData() == null) {
        return;
    }

    TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
    List<String> segments = intent.getData().getPathSegments();
    if (segments.isEmpty()) {
        Intent launcherIntent = getPackageManager().getLaunchIntentForPackage(getPackageName());
        if (launcherIntent != null) {
            startActivity(launcherIntent.putExtras(intent));
        }
        return;
    }

    for (String segment : intent.getData().getPathSegments()) {
        if (activityMap.containsKey(segment)) {
            Intent nextIntent = new Intent(this, activityMap.get(segment)).putExtras(intent);
            stackBuilder.addNextIntent(nextIntent);
        }
    }
    stackBuilder.startActivities();
}
 
开发者ID:infobip,项目名称:mobile-messaging-sdk-android,代码行数:25,代码来源:DeepLinkLandingActivity.java

示例7: createBackStack

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
private void createBackStack(Intent intent) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        TaskStackBuilder builder = TaskStackBuilder.create(this);
        builder.addNextIntentWithParentStack(intent);
        builder.startActivities();
    } else {
        startActivity(intent);
        finish();
    }
}
 
开发者ID:qqq3,项目名称:inventum,代码行数:11,代码来源:BaseActivity.java

示例8: createBackStack

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
/**
 * Enables back navigation for activities that are launched from the NavBar. See
 * {@code AndroidManifest.xml} to find out the parent activity names for each activity.
 * @param intent
 */
private void createBackStack(Intent intent) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        TaskStackBuilder builder = TaskStackBuilder.create(this);
        builder.addNextIntentWithParentStack(intent);
        builder.startActivities();
    } else {
        startActivity(intent);
        finish();
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:16,代码来源:BaseActivity.java

示例9: createBackStack

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
private void createBackStack(Intent intent) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
    TaskStackBuilder builder = TaskStackBuilder.create(this);
    builder.addNextIntentWithParentStack(intent);
    builder.startActivities();
  } else {
    startActivity(intent);
    finish();
  }
}
 
开发者ID:g11x,项目名称:checklistapp,代码行数:11,代码来源:NavigationActivity.java

示例10: createBackStack

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
/**
 * Enables back navigation for activities that are launched from the NavBar. See
 * {@code AndroidManifest.xml} to find out the parent activity names for each activity.
 *
 * @param intent
 */
private void createBackStack(Intent intent) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        TaskStackBuilder builder = TaskStackBuilder.create(this);
        builder.addNextIntentWithParentStack(intent);
        builder.startActivities();
    } else {
        startActivity(intent);
        finish();
    }
}
 
开发者ID:SecUSo,项目名称:privacy-friendly-werewolf,代码行数:17,代码来源:BaseActivity.java

示例11: navigateUpOrBack

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
/**
 * This utility method handles Up navigation intents by searching for a parent activity and
 * navigating there if defined. When using this for an activity make sure to define both the
 * native parentActivity as well as the AppCompat one when supporting API levels less than 16.
 * when the activity has a single parent activity. If the activity doesn't have a single parent
 * activity then don't define one and this method will use back button functionality. If "Up"
 * functionality is still desired for activities without parents then use
 * {@code syntheticParentActivity} to define one dynamically.
 * <p>
 * Note: Up navigation intents are represented by a back arrow in the top left of the Toolbar
 * in Material Design guidelines.
 *
 * @param currentActivity         Activity in use when navigate Up action occurred.
 * @param syntheticParentActivity Parent activity to use when one is not already configured.
 */
public static void navigateUpOrBack(Activity currentActivity,
                                    Class<? extends Activity> syntheticParentActivity) {
    // Retrieve parent activity from AndroidManifest.
    Intent intent = NavUtils.getParentActivityIntent(currentActivity);

    // Synthesize the parent activity when a natural one doesn't exist.
    if (intent == null && syntheticParentActivity != null) {
        try {
            intent = NavUtils.getParentActivityIntent(currentActivity, syntheticParentActivity);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
    }

    if (intent == null) {
        // No parent defined in manifest. This indicates the activity may be used by
        // in multiple flows throughout the app and doesn't have a strict parent. In
        // this case the navigation up button should act in the same manner as the
        // back button. This will result in users being forwarded back to other
        // applications if currentActivity was invoked from another application.
        currentActivity.onBackPressed();
    } else {
        if (NavUtils.shouldUpRecreateTask(currentActivity, intent)) {
            // Need to synthesize a backstack since currentActivity was probably invoked by a
            // different app. The preserves the "Up" functionality within the app according to
            // the activity hierarchy defined in AndroidManifest.xml via parentActivity
            // attributes.
            TaskStackBuilder builder = TaskStackBuilder.create(currentActivity);
            builder.addNextIntentWithParentStack(intent);
            builder.startActivities();
        } else {
            // Navigate normally to the manifest defined "Up" activity.
            NavUtils.navigateUpTo(currentActivity, intent);
        }
    }
}
 
开发者ID:ashishbhandari,项目名称:RetailStore,代码行数:52,代码来源:BaseActivity.java

示例12: createBackStack

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
/**
 * Enables back navigation for activities that are launched from the NavBar. See
 * {@code AndroidManifest.xml} to find out the parent activity names for each activity.
 * @param intent
 */
private void createBackStack(Intent intent) {
    final Bundle bundle = ActivityOptionsCompat
            .makeCustomAnimation(this, android.R.anim.fade_in, android.R.anim.fade_out)
            .toBundle();

    TaskStackBuilder builder = TaskStackBuilder.create(this);
    builder.addNextIntentWithParentStack(intent);
    builder.startActivities(bundle);
}
 
开发者ID:Hotmart-Org,项目名称:zum-android,代码行数:15,代码来源:BaseActivity.java

示例13: createBackStack

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
/**
 * Enables back navigation for activities that are launched from the NavBar. See
 * {@code AndroidManifest.xml} to find out the parent activity names for each activity.
 *
 * @param intent
 */
private void createBackStack(Intent intent)
{
    if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN )
    {
        TaskStackBuilder builder = TaskStackBuilder.create(this);
        builder.addNextIntentWithParentStack(intent);
        builder.startActivities();
    }
    else
    {
        startActivity(intent);
        finish();
    }
}
 
开发者ID:SecUSo,项目名称:privacy-friendly-shopping-list,代码行数:21,代码来源:BaseActivity.java

示例14: onSupportNavigateUp

import android.support.v4.app.TaskStackBuilder; //导入方法依赖的package包/类
/**
 * This method is called whenever the user chooses to navigate Up within your application's
 * activity hierarchy from the action bar.
 * <p/>
 * <p>If a parent was specified in the manifest for this activity or an activity-alias to it,
 * default Up navigation will be handled automatically. See
 * {@link #getSupportParentActivityIntent()} for how to specify the parent. If any activity
 * along the parent chain requires extra Intent arguments, the Activity subclass
 * should override the method {@link #onPrepareSupportNavigateUpTaskStack(android.support.v4.app.TaskStackBuilder)}
 * to supply those arguments.</p>
 * <p/>
 * <p>See <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and
 * Back Stack</a> from the developer guide and
 * <a href="{@docRoot}design/patterns/navigation.html">Navigation</a> from the design guide
 * for more information about navigating within your app.</p>
 * <p/>
 * <p>See the {@link android.support.v4.app.TaskStackBuilder} class and the Activity methods
 * {@link #getSupportParentActivityIntent()}, {@link #supportShouldUpRecreateTask(android.content.Intent)}, and
 * {@link #supportNavigateUpTo(android.content.Intent)} for help implementing custom Up navigation.</p>
 *
 * @return true if Up navigation completed successfully and this Activity was finished,
 * false otherwise.
 */
public boolean onSupportNavigateUp() {
    Intent upIntent = getSupportParentActivityIntent();
    if (upIntent != null) {
        if (supportShouldUpRecreateTask(upIntent)) {
            TaskStackBuilder b = getStackBuilder();
            onCreateSupportNavigateUpTaskStack(b);
            onPrepareSupportNavigateUpTaskStack(b);
            b.startActivities();
            finish();
        } else {
            // This activity is part of the application's task, so simply
            // navigate up to the hierarchical parent activity.
            supportNavigateUpTo(upIntent);
        }
        return true;
    }
    return false;
}
 
开发者ID:sourceallies,项目名称:zonebeacon,代码行数:42,代码来源:RoboAppCompatActivity.java


注:本文中的android.support.v4.app.TaskStackBuilder.startActivities方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。