Android library language update

Source: Internet
Author: User

In Chinese mode, go to the first interface of the image library to view all album sets. Press the home Key, set the language of the mobile phone to English, and then return to the image library to view that the album name is still Chinese. How to update the album name in the Image Library after changing the language on your mobile phone


1. google default is designed to obtain the album name based on the resource type in the constructor for creating each album. Therefore, when the image library is paused (onPause is executed) and enters again, the language is not updated in time.
 
2. The idea is to re-obtain the album name based on the corresponding resource type when you enter the image library again. The specific modification method is as follows:
(1) In Gallery2 \ src \ com \ android \ gallery3d \ data \ LocalMergeAlbum. javaLocalMergeAlbum. java:
@ Override
Public String getName (){
MName = mSources. length = 0? "": MSources [0]. getName ();
Return mName;
}
(2) In Gallery2 \ src \ com \ android \ gallery3d \ data \ LocalAlbum. java:
First, modify: Define a String variable:
Private String mTempName;
Modify the second part: In the LocalAlbum constructor:
Public LocalAlbum (Path path, GalleryApp application, int bucketId, boolean isImage, String name ){
...
MName = getLocalizedName (application. getResources (), bucketId, name );
MTempName = mName ;...
}

Third, modify the refreshName () method ()
Public void refreshName (String Name ){
MTempName = getLocalizedName (mApplication. getResources (), mBucketId, Name );
}
Modify the fourth part: In the getName () method:
@ Override
Public String getName (){
Refresh (mTempName );
// Return mName;
Return mTempName;
}

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.