Android System switching language Update application interface method

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.