A recent upgrade application, in the process of downloading the upgrade package, there is another toast type of dialog suspended in the upper right corner of the screen, this time to switch the system language will be a problem.
When the main screen to upgrade the application, the switch system language upgrade application restart, and restart will not be automatically after the breakpoint to resume the download progress before the switch, when the main screen is launcher, switching system language progress bar of the prompt language can not follow the switch;
The solution to this problem is mainly divided into the following steps:
1. Set the system switch language does not restart the property, in the activity of Menifest set android:configchanges= "locale|layoutdirection", switch language can avoid the application by the system restart, otherwise it will interrupt the download;
2. Implementation of the progress bar service listening language switch broadcast after the language function, action_locale_changed; Download and interface refresh is two threads, so this step is mainly responsible for the interface refresh service re-refresh interface, to achieve language synchronization switching purposes;
3. Implement the updateactivity callback onconfigurationchanged and reset the interface language.
@Override
public void onconfigurationchanged (Android.content.res.Configuration newconfig) {
Super.onconfigurationchanged (Newconfig);
System language change callback, due to the setting of the switch language does not restart the properties (to ensure that the download is not interrupted), so you need to reset the interface language
LOG.D ("YJ", "=========================onconfigurationchanged ....");
TextView TextView01 = (TextView) Findviewbyid (R.ID.TEXTVIEW01);
Textview01.settext (R.string.sysupdate_soft);
TextView TextView02 = (TextView) Findviewbyid (R.ID.TEXTVIEW02);
Textview02.settext (r.string.localupdate);
TextView TextView03 = (TextView) Findviewbyid (r.id.textview03);
Textview03.settext (r.string.networkupdate);
};
These three steps at the same time will be perfect to solve the problem, write this post record.
Android System switching language Update application interface method