问题
We are localizing our app to be able to easily switch between languages. Everything works nicely except for some cached values that are actually in navigation. We have two options:
completely restart app on language change - in this case I need a notification and force restart
just load new strings into the table - in this case it will require to replace string values and rbuild custom navigation state.
IN both cases we need a way to find out when language switches. Is there an intent we can listen to? If yes could you please advise on which one? I am thinking to go with a broadcast receiver. I am just not sure which intent action it is. In below example what is the SOME_ACTION value?
Thanks in advance.
<receiver android:name="com.v1.application.notifications.LanguageChangeReceiver">
<intent-filter>
<action android:name="android.intent.action.SOME_ACTION" />
</intent-filter>
</receiver>
回答1:
android.intent.action.CONFIGURATION_CHANGED
来源:https://stackoverflow.com/questions/9776313/android-locale-notification-need-to-dump-cache