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


Java AppCompatActivity.startActivity方法代码示例

本文整理汇总了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);
    }
 
开发者ID:LightSun,项目名称:android-util2,代码行数:17,代码来源:IntentHelper.java

示例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);
    }
 
开发者ID:djuelg,项目名称:Neuronizer,代码行数:22,代码来源:RadioDialogs.java

示例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());
    }
 
开发者ID:wuhighway,项目名称:DailyStudy,代码行数:20,代码来源:ViewerActivity.java

示例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();
}
 
开发者ID:lmnpWmi,项目名称:wirtualnaApteczka,代码行数:9,代码来源:SessionManager.java

示例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);
}
 
开发者ID:raulh82vlc,项目名称:Transactions-Viewer,代码行数:12,代码来源:ProductsTransactionsActivity.java

示例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);
    }
}
 
开发者ID:raulh82vlc,项目名称:Avengers,代码行数:18,代码来源:ComicDetailsActivity.java

示例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()));
    }
 
开发者ID:eyeRS,项目名称:eyeRS,代码行数:12,代码来源:SettingUtilities.java

示例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);
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:7,代码来源:Util.java


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