當前位置: 首頁>>代碼示例>>Java>>正文


Java Activity.recreate方法代碼示例

本文整理匯總了Java中android.app.Activity.recreate方法的典型用法代碼示例。如果您正苦於以下問題:Java Activity.recreate方法的具體用法?Java Activity.recreate怎麽用?Java Activity.recreate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.app.Activity的用法示例。


在下文中一共展示了Activity.recreate方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: recreate

import android.app.Activity; //導入方法依賴的package包/類
/**
 * Helper method to recreate the Activity. This method should be called after a Locale change.
 * @param activity the Activity that will be recreated
 * @param animate a flag indicating if the recreation will be animated or not
 */
public static void recreate(Activity activity, boolean animate) {
    if (animate) {
        Intent restartIntent = new Intent(activity, activity.getClass());

        Bundle extras = activity.getIntent().getExtras();
        if (extras != null) {
            restartIntent.putExtras(extras);
        }
        ActivityCompat.startActivity(
                activity,
                restartIntent,
                ActivityOptionsCompat
                        .makeCustomAnimation(activity, android.R.anim.fade_in, android.R.anim.fade_out)
                        .toBundle()
        );
        activity.finish();
    } else {
        activity.recreate();
    }
}
 
開發者ID:franmontiel,項目名稱:LocaleChanger,代碼行數:26,代碼來源:ActivityRecreationHelper.java

示例2: onResume

import android.app.Activity; //導入方法依賴的package包/類
@Override
public void onResume() {
    super.onResume();
    getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
    onShowDonationChanged();
    Preference preference = getPreferenceScreen().findPreference("brevent_about_developer");
    if (!SimpleSu.hasSu() && AppsDisabledFragment.isAdbRunning()) {
        preference.setSummary(R.string.brevent_about_developer_adb);
    } else {
        preference.setSummary(null);
    }
    preference.setOnPreferenceClickListener(this);
    if (BuildConfig.RELEASE) {
        Activity activity = getActivity();
        BreventApplication application = (BreventApplication) activity.getApplication();
        double donation = BreventApplication.getDonation(application);
        int playDonation = BreventApplication.getPlayDonation(application);
        String amount = DecimalUtils.format(donation + playDonation);
        if (mAmount == null) {
            mAmount = amount;
        } else if (!Objects.equals(mAmount, amount)) {
            activity.recreate();
        }
    }
}
 
開發者ID:brevent,項目名稱:Brevent,代碼行數:26,代碼來源:SettingsFragment.java

示例3: onChangeHarvestMessage

import android.app.Activity; //導入方法依賴的package包/類
@WorkMessageHandler(ChangeHarvestMessage.class)
public void onChangeHarvestMessage(ChangeHarvestMessage message) {
    if (message.localId == mEvent.mLocalId) {
        return;
    }

    final Activity activity = getActivity();

    GameHarvest harvest = GameDatabase.getInstance().getEventByLocalId(message.localId);

    if (harvest != null) {
        activity.getIntent().putExtra(HarvestActivity.EXTRA_HARVEST, harvest);
        activity.getIntent().putExtra(HarvestActivity.EXTRA_NEW, false);

        activity.recreate();
    }
}
 
開發者ID:suomenriistakeskus,項目名稱:oma-riista-android,代碼行數:18,代碼來源:HarvestFragment.java

示例4: createExitRevealEffect

import android.app.Activity; //導入方法依賴的package包/類
public void createExitRevealEffect(final Activity activity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        final View rootView = ((ViewGroup)activity.findViewById(Window.ID_ANDROID_CONTENT)).getChildAt(0);
        Animator revealEffect = createRevealEffect(rootView, Status.EXIT);
        revealEffect.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                rootView.setVisibility(View.INVISIBLE);
                activity.recreate();
            }
        });
        revealEffect.start();
    } else {
        activity.recreate();
    }
}
 
開發者ID:fendoudebb,項目名稱:PlayAndroid,代碼行數:17,代碼來源:RevealEffectUtil.java

示例5: onPreferenceChange

import android.app.Activity; //導入方法依賴的package包/類
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
    if ("brevent_language".equals(preference.getKey())) {
        Activity activity = getActivity();
        String language = String.valueOf(newValue);
        if ("auto".equals(language)) {
            language = "";
        }
        if (LocaleUtils.setOverrideLanguage(activity, language)) {
            getArguments().putBoolean(LOCALE_CHANGED, true);
            activity.recreate();
        }
    }
    return true;
}
 
開發者ID:brevent,項目名稱:Brevent,代碼行數:16,代碼來源:SettingsFragment.java

示例6: registerPreferenceUpdater

import android.app.Activity; //導入方法依賴的package包/類
public static void registerPreferenceUpdater(Activity activity) {

            if (isPreferenceChanged.containsKey(mTag) && sPreference && isPreferenceChanged.get(mTag)) {

                activity.recreate();
                sPreference = false;
            }
    }
 
開發者ID:enricocid,項目名稱:ColorBox-library,代碼行數:9,代碼來源:ColorBox.java

示例7: recreate

import android.app.Activity; //導入方法依賴的package包/類
@TargetApi(11)
public static void recreate(Activity activity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        activity.recreate();
    }
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:7,代碼來源:MethodsCompat.java


注:本文中的android.app.Activity.recreate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。