Camera Shutter Sound can't restore to default

原创
2012/09/17 20:16
阅读数 425

Launch Camera --> check shutter sound default status is "OFF" --> set the shutter sound status to "ON" --> click the restore to default button --> the shutter sound status isn't the default value "OFF"

 

As the customization and the value of SDMID isn't "on" or "off",so I must translate it in the java code. But the preference.xml has the definition (KEY_SHUTTER_SOUND),and the default value is this:

<ListPreference 
    camera:key = "pref_camera_shutter_sound"
    camera:defaultValue="@string/pref_camera_shutter_sound_default"
    ...
/>

If I don't deal with it,the default value isn't via customization but

camera:defaultValue="@string/pref_camera_shutter_sound_default"

So I set the shutter sound default value in the method restorePreferences()  in the CameraSettings.java manually.I add a function:

private static void setShutterSoundDefault() {

      SharedPreferences.Editor editor = preferences.edit();

      editor.putString(KEY_SHUTTER_SOUND,shutterValue);

      editor.apply();

}

and  add it end of the restorePreference().The shutterValue is from SDM which you want to custom,not 

camera:defaultValue="@string/pref_camera_shutter_sound_default"

OK,it can work now.

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部