├── .gitignore ├── .idea ├── .name ├── SwitchLanguage.iml ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── misc.xml ├── modules.xml ├── vcs.xml └── workspace.xml ├── README.md └── SwitchLanguage ├── .classpath ├── .idea ├── .name ├── SwitchLanguage.iml ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── misc.xml ├── modules.xml └── workspace.xml ├── .project ├── .settings ├── org.eclipse.core.resources.prefs └── org.eclipse.jdt.core.prefs ├── AndroidManifest.xml ├── bin ├── AndroidManifest.xml ├── SwitchLanguage.apk ├── classes.dex ├── dexedLibs │ ├── android-support-v4-73a73a99ed2405b2c392f3e1f50333c1.jar │ └── android-support-v4-a0baa4d5bf821448353914fecafaea7a.jar ├── jarlist.cache ├── res │ └── crunch │ │ ├── drawable-hdpi │ │ ├── icon_anguage.png │ │ └── img_label.png │ │ ├── drawable-mdpi │ │ └── icon_anguage.png │ │ ├── drawable-xhdpi │ │ └── icon_anguage.png │ │ └── drawable-xxhdpi │ │ └── icon_anguage.png └── resources.ap_ ├── ic_launcher-web.png ├── libs └── android-support-v4.jar ├── proguard-project.txt ├── project.properties ├── res ├── drawable-hdpi │ ├── icon_anguage.png │ └── img_label.png ├── drawable-mdpi │ └── icon_anguage.png ├── drawable-xhdpi │ └── icon_anguage.png ├── drawable-xxhdpi │ └── icon_anguage.png ├── layout │ ├── language.xml │ └── language_item.xml ├── values-en-rUS │ └── strings.xml ├── values-en │ └── strings.xml ├── values-v11 │ └── styles.xml ├── values-v14 │ └── styles.xml ├── values-zh │ └── strings.xml └── values │ ├── color.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── screenshot └── language.gif └── src └── com └── github ├── changelanguage ├── LanguageActivity.java └── LanguageInfo.java └── language ├── adapter └── LanguageAdapter.java └── controller ├── LanguageController.java ├── ListViewUtils.java ├── ThreadPoolManager.java └── UpdateLanguageUtils.java /.gitignore: -------------------------------------------------------------------------------- 1 | *.agdai 2 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | SwitchLanguage -------------------------------------------------------------------------------- /.idea/SwitchLanguage.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 1.8 19 | 20 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | 31 | 33 | 34 | 37 | 38 | 39 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 81 | 82 | 83 | 84 | 87 | 88 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 120 | 121 | 122 | 123 | 137 | 138 | 139 | 140 | 141 | 142 | 149 | 150 | 151 | 152 | 170 | 177 | 178 | 186 | 187 | 189 | 190 | 191 | 192 | 193 | 194 | 1458719726026 195 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 230 | 231 | 232 | 233 | 234 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SwitchLanguage 2 | 关于我,欢迎关注~ 3 | [我的博客](http://blog.csdn.net/u011974987) 本Demo地址:[click here](http://blog.csdn.net/u011974987/article/details/50801770); 4 | * 项目描述: 5 | 本Demo主要运用于切换系统语言的功能,一般会在做出厂设置的App 会有这需求,但是Google并没有开放更改系统语言的接口,查看‘FrameWork’ 层'Settings' 源码下,有相关的功能,属于隐藏接口,所以我们利用反射机制来调用系统的API,虽然不是很靠谱,但是满足了我们的需求,我把项目整理的下,放在[GitHub](https://github.com/git-xuhao/SwitchLanguage) 上面了。 6 | 7 | * 本Demo效果截图示例如下: 8 | 9 | ![](https://github.com/git-xuhao/SwitchLanguage/raw/master/SwitchLanguage/screenshot/language.gif) 10 | 11 | 更新日志: 12 | --------- 13 | * v1.0: 14 | 初始化该项目 15 | 添加了icon。 16 | ###NOTICE!!! 17 | ---------- 18 | * 需要注意的是调用此方法: 19 | // objIActMag.updateConfiguration(config); 20 | mtdIActMag$updateConfiguration.invoke(objIActMag, config); 21 | 22 | *需要加上权限:android.permission.CHANGE_CONFIGURATION 23 | 并且此处会重新调用onCreate方法,我就在这个地方处被坑了一把。(如果调用此方法的时候做了一些逻辑,就注意下)。 24 | 25 | 最后声明: 26 | ---------------- 27 | 既然是更改系统的配置当然你的签名也应该是系统签名和sharedUserId。不然会类似以下的错误! 28 | 29 | error: 30 | ------ 31 | java.lang.SecurityException: Permission Denial: updateConfiguration() from pid=31594, uid=10099 requires android.permission.CHANGE_CONFIGURATION 32 | 33 | 各位都注意下吧~ 34 | 35 | ##Thanks! 36 | 37 | *[SwitchLanguage](https://github.com/git-xuhao/SwitchLanguage) 38 | -------------------------------------------------------------------------------- /SwitchLanguage/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /SwitchLanguage/.idea/.name: -------------------------------------------------------------------------------- 1 | SwitchLanguage -------------------------------------------------------------------------------- /SwitchLanguage/.idea/SwitchLanguage.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SwitchLanguage/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /SwitchLanguage/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /SwitchLanguage/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /SwitchLanguage/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 1.8 19 | 20 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /SwitchLanguage/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwitchLanguage/.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 26 | 27 | 28 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 69 | 70 | 71 | 72 | 75 | 76 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 120 | 121 | 122 | 143 | 144 | 145 | 158 | 159 | 160 | 167 | 170 | 172 | 173 | 174 | 175 | 176 | 177 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 237 | 238 | 245 | 246 | 247 | 248 | 266 | 273 | 274 | 275 | 276 | 294 | 301 | 302 | 310 | 311 | 313 | 314 | 315 | 316 | 317 | 318 | 1458719335537 319 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 354 | 355 | 356 | 357 | 358 | -------------------------------------------------------------------------------- /SwitchLanguage/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | SwitchLanguage 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /SwitchLanguage/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /SwitchLanguage/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.source=1.6 5 | -------------------------------------------------------------------------------- /SwitchLanguage/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /SwitchLanguage/bin/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /SwitchLanguage/bin/SwitchLanguage.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/git-xuhao/SwitchLanguage/5dd4630fa6b050fe0b1672ca73e513d3c0e6b043/SwitchLanguage/bin/SwitchLanguage.apk -------------------------------------------------------------------------------- /SwitchLanguage/bin/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/git-xuhao/SwitchLanguage/5dd4630fa6b050fe0b1672ca73e513d3c0e6b043/SwitchLanguage/bin/classes.dex -------------------------------------------------------------------------------- /SwitchLanguage/bin/dexedLibs/android-support-v4-73a73a99ed2405b2c392f3e1f50333c1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/git-xuhao/SwitchLanguage/5dd4630fa6b050fe0b1672ca73e513d3c0e6b043/SwitchLanguage/bin/dexedLibs/android-support-v4-73a73a99ed2405b2c392f3e1f50333c1.jar -------------------------------------------------------------------------------- /SwitchLanguage/bin/dexedLibs/android-support-v4-a0baa4d5bf821448353914fecafaea7a.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/git-xuhao/SwitchLanguage/5dd4630fa6b050fe0b1672ca73e513d3c0e6b043/SwitchLanguage/bin/dexedLibs/android-support-v4-a0baa4d5bf821448353914fecafaea7a.jar -------------------------------------------------------------------------------- /SwitchLanguage/bin/jarlist.cache: -------------------------------------------------------------------------------- 1 | # cache for current jar dependency. DO NOT EDIT. 2 | # format is 3 | # Encoding is UTF-8 4 | -------------------------------------------------------------------------------- /SwitchLanguage/bin/res/crunch/drawable-hdpi/icon_anguage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/git-xuhao/SwitchLanguage/5dd4630fa6b050fe0b1672ca73e513d3c0e6b043/SwitchLanguage/bin/res/crunch/drawable-hdpi/icon_anguage.png -------------------------------------------------------------------------------- /SwitchLanguage/bin/res/crunch/drawable-hdpi/img_label.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/git-xuhao/SwitchLanguage/5dd4630fa6b050fe0b1672ca73e513d3c0e6b043/SwitchLanguage/bin/res/crunch/drawable-hdpi/img_label.png -------------------------------------------------------------------------------- /SwitchLanguage/bin/res/crunch/drawable-mdpi/icon_anguage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/git-xuhao/SwitchLanguage/5dd4630fa6b050fe0b1672ca73e513d3c0e6b043/SwitchLanguage/bin/res/crunch/drawable-mdpi/icon_anguage.png -------------------------------------------------------------------------------- /SwitchLanguage/bin/res/crunch/drawable-xhdpi/icon_anguage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/git-xuhao/SwitchLanguage/5dd4630fa6b050fe0b1672ca73e513d3c0e6b043/SwitchLanguage/bin/res/crunch/drawable-xhdpi/icon_anguage.png -------------------------------------------------------------------------------- /SwitchLanguage/bin/res/crunch/drawable-xxhdpi/icon_anguage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/git-xuhao/SwitchLanguage/5dd4630fa6b050fe0b1672ca73e513d3c0e6b043/SwitchLanguage/bin/res/crunch/drawable-xxhdpi/icon_anguage.png -------------------------------------------------------------------------------- /SwitchLanguage/bin/resources.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/git-xuhao/SwitchLanguage/5dd4630fa6b050fe0b1672ca73e513d3c0e6b043/SwitchLanguage/bin/resources.ap_ -------------------------------------------------------------------------------- /SwitchLanguage/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/git-xuhao/SwitchLanguage/5dd4630fa6b050fe0b1672ca73e513d3c0e6b043/SwitchLanguage/ic_launcher-web.png -------------------------------------------------------------------------------- /SwitchLanguage/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/git-xuhao/SwitchLanguage/5dd4630fa6b050fe0b1672ca73e513d3c0e6b043/SwitchLanguage/libs/android-support-v4.jar -------------------------------------------------------------------------------- /SwitchLanguage/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /SwitchLanguage/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-21 15 | -------------------------------------------------------------------------------- /SwitchLanguage/res/drawable-hdpi/icon_anguage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/git-xuhao/SwitchLanguage/5dd4630fa6b050fe0b1672ca73e513d3c0e6b043/SwitchLanguage/res/drawable-hdpi/icon_anguage.png -------------------------------------------------------------------------------- /SwitchLanguage/res/drawable-hdpi/img_label.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/git-xuhao/SwitchLanguage/5dd4630fa6b050fe0b1672ca73e513d3c0e6b043/SwitchLanguage/res/drawable-hdpi/img_label.png -------------------------------------------------------------------------------- /SwitchLanguage/res/drawable-mdpi/icon_anguage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/git-xuhao/SwitchLanguage/5dd4630fa6b050fe0b1672ca73e513d3c0e6b043/SwitchLanguage/res/drawable-mdpi/icon_anguage.png -------------------------------------------------------------------------------- /SwitchLanguage/res/drawable-xhdpi/icon_anguage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/git-xuhao/SwitchLanguage/5dd4630fa6b050fe0b1672ca73e513d3c0e6b043/SwitchLanguage/res/drawable-xhdpi/icon_anguage.png -------------------------------------------------------------------------------- /SwitchLanguage/res/drawable-xxhdpi/icon_anguage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/git-xuhao/SwitchLanguage/5dd4630fa6b050fe0b1672ca73e513d3c0e6b043/SwitchLanguage/res/drawable-xxhdpi/icon_anguage.png -------------------------------------------------------------------------------- /SwitchLanguage/res/layout/language.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 16 | 17 | 27 | 28 | 36 | 37 | 41 | 42 |