【问题标题】:onConfigurationChange does not get calledonConfigurationChange 没有被调用
【发布时间】:2014-02-13 10:50:55
【问题描述】:

我正在尝试处理发生 inapp 语言更改后需要刷新视图的情况

但是,onConfigurationChange 方法根本没有被调用。

我在我的清单中添加了以下标志:

 android:configChanges="locale"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustResize|adjustPan"




public void onConfigurationChanged(android.content.res.Configuration newConfig) {
        LogUtils.d("configuration has changed:%s",newConfig); => this line never runs
        super.onConfigurationChanged(newConfig);
    };

如何使 onConfigurationChanged 方法运行?

【问题讨论】:

    标签: android configuration


    【解决方案1】:

    Android 为该任务注册了一个 Intent,即 ACTION_LOCALE_CHANGED。所以我相信你必须注册一个 BroadcastReceiver 来监听这个 Intent 过滤器,然后在你监听它时执行必要的步骤。我不确定整个代码,但这里有一个可能有帮助的链接。 http://android.codota.com/scenarios/518914fada0a610ad0c274da/android.content.IntentFilter?tag=out_2013_05_05_07_19_34

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-14
      • 1970-01-01
      • 2011-11-15
      • 1970-01-01
      • 1970-01-01
      • 2018-11-25
      • 2019-03-31
      • 2012-12-16
      相关资源
      最近更新 更多