當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。