当前位置: 首页>>代码示例>>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;未经允许,请勿转载。