本文整理汇总了Java中android.support.v7.app.AppCompatActivity.startActivity方法的典型用法代码示例。如果您正苦于以下问题:Java AppCompatActivity.startActivity方法的具体用法?Java AppCompatActivity.startActivity怎么用?Java AppCompatActivity.startActivity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.app.AppCompatActivity
的用法示例。
在下文中一共展示了AppCompatActivity.startActivity方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: share
import android.support.v7.app.AppCompatActivity; //导入方法依赖的package包/类
public static void share(AppCompatActivity context, List<String> paths) {
if (paths == null || paths.size() == 0) {
return;
}
ArrayList<Uri> uris = new ArrayList<>();
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_SEND_MULTIPLE);
intent.setType("*/*");
for (String path : paths) {
File file = new File(path);
uris.add(Uri.fromFile(file));
}
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
context.startActivity(intent);
}
示例2: showIntroDialog
import android.support.v7.app.AppCompatActivity; //导入方法依赖的package包/类
public static void showIntroDialog(final AppCompatActivity activity) {
RadioDialogCallback callback = new RadioDialogCallback() {
@Override
public void which(int position) {
if (position == 0) {
activity.startActivity(IntroActivity.previewIntroInstance(activity));
activity.finish();
} else {
activity.startActivity(IntroActivity.todoListIntroInstance(activity, null, null));
activity.finish();
}
}
};
CharSequence[] items = new CharSequence[]{
getString(activity, R.string.intro_preview),
getString(activity, R.string.intro_todo_list),
};
showRadioDialog(activity, getString(activity, R.string.intro_dialog), items, callback);
}
示例3: launch
import android.support.v7.app.AppCompatActivity; //导入方法依赖的package包/类
public static void launch(AppCompatActivity activity, View transitionView, int resId) {
// Intent intent = new Intent(activity, ViewerActivity.class);
//
//
// ActivityOptionsCompat options = ActivityOptionsCompat
// .makeSceneTransitionAnimation(activity, transitionView, "image");
//
// ActivityCompat.startActivity(activity, intent, options.toBundle());
Pair squareParticipant = new Pair<>(transitionView, ViewCompat.getTransitionName(transitionView));
ActivityOptionsCompat transitionActivityOptions =
ActivityOptionsCompat.makeSceneTransitionAnimation(
activity, squareParticipant);
Intent intent = new Intent(
activity, ViewerActivity.class);
intent.putExtra("resId", resId);
activity.startActivity(intent, transitionActivityOptions.toBundle());
}
示例4: closeApplication
import android.support.v7.app.AppCompatActivity; //导入方法依赖的package包/类
public static void closeApplication(AppCompatActivity context) {
Intent intent = new Intent(context, LauncherActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(AppConstants.EXIT, true);
context.startActivity(intent);
context.finish();
}
示例5: navigateToDetailsActivity
import android.support.v7.app.AppCompatActivity; //导入方法依赖的package包/类
public static void navigateToDetailsActivity(AppCompatActivity activity, String sku,
String pathRates, String pathTransactions) {
Intent intent = new Intent(activity, ProductsTransactionsActivity.class);
Bundle data = new Bundle();
data.putString(KEY_PRODUCT_SKU, sku);
data.putString(KEY_TRANSACTIONS_PATH, pathTransactions);
data.putString(KEY_RATES_PATH, pathRates);
intent.putExtras(data);
activity.startActivity(intent);
activity.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
}
示例6: navigateToDetailsActivity
import android.support.v7.app.AppCompatActivity; //导入方法依赖的package包/类
/**
* Navigate To details of the comic using different animations depending on the Android version
*/
public static void navigateToDetailsActivity(AppCompatActivity activity, ComicUI comic, View view) {
Intent intent = new Intent(activity, ComicDetailsActivity.class);
Bundle data = new Bundle();
data.putParcelable(KEY_COMIC, comic);
intent.putExtras(data);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation(activity,
view, IMG_TRANSITION_TAG);
ActivityCompat.startActivity(activity, intent, optionsCompat.toBundle());
} else {
activity.startActivity(intent);
activity.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
}
}
示例7: changeToTheme
import android.support.v7.app.AppCompatActivity; //导入方法依赖的package包/类
/**
* Set the theme of the Activity, and restart it by creating a new Activity of the same type.
*/
static void changeToTheme(AppCompatActivity activity, int theme) {
// sTheme = theme;
EyeRS.PREFERENCES.putInteger("theme", theme);
EyeRS.PREFERENCES.flush();
// activity.setTheme(theme);
activity.finish();
activity.startActivity(new Intent(activity, activity.getClass()));
}
示例8: openUrl
import android.support.v7.app.AppCompatActivity; //导入方法依赖的package包/类
public static void openUrl(AppCompatActivity context, String str) {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(Uri.parse(str));
intent.setFlags(268435456);
context.startActivity(intent);
}