Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/219.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
有没有办法在android中本地化棉花糖权限字符串?_Android_Localization_Android Permissions - Fatal编程技术网

有没有办法在android中本地化棉花糖权限字符串?

有没有办法在android中本地化棉花糖权限字符串?,android,localization,android-permissions,Android,Localization,Android Permissions,我正在尝试对权限消息进行本地化,例如允许应用程序访问相机以拍摄照片或视频等 应用程序的其余部分已本地化 以下是我迄今为止所做的尝试: @Override protected void attachBaseContext(Context base) { super.attachBaseContext(App.localeManager.setLocale(base)); Log.d(TAG, "attachBaseContext"); } public Context setLo

我正在尝试对权限消息进行本地化,例如允许应用程序访问相机以拍摄照片或视频

应用程序的其余部分已本地化

以下是我迄今为止所做的尝试:

@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(App.localeManager.setLocale(base));
    Log.d(TAG, "attachBaseContext");
}

public Context setLocale(Context c) {
    return updateResources(c, getLanguage());
}

private Context updateResources(Context context, String language) {
   Locale locale = new Locale(language);
   Locale.setDefault(locale);

   Resources res = context.getResources();
   Configuration config = new Configuration(res.getConfiguration());

   if (Utility.isAtLeastVersion(JELLY_BEAN_MR1)) {
    config.setLocale(locale);
    context = context.createConfigurationContext(config);
    } else {
        config.locale = locale;
        res.updateConfiguration(config, res.getDisplayMetrics());
    }
    return context;
}
还有一件事,如果在设置中更改语言,权限消息将本地化。


非常感谢您的帮助。

否。权限请求对话框显示在设备的区域设置中。

否。权限请求对话框显示在设备的区域设置中