Pourquoi ne souhaitez-vous pas conserver le zoom de l'appareil photo après avoir quitté l'aktivity ?
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu_old);
SharedPreferences preferences = getSharedPreferences("goodnight", MODE_PRIVATE);
yourCheckBox = (CheckBox) findViewById( R.id.fonarb );
yourCheckBox.setChecked(preferences.getBoolean("lol", false));
yourCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
@Override
public void onCheckedChanged(CompoundButton yourCheckBox,
boolean isChecked) {
if (isChecked){
Parameters params = camera.getParameters();
params.setZoom(5);
camera.setParameters(params);
}
else {
Parameters params = camera.getParameters();
params.setZoom(0);
camera.setParameters(params);
}
}
});
public void onStop() {
super.onStop();
SharedPreferences settings = getSharedPreferences("goodnight", MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("lol", yourCheckBox.isChecked());
editor.commit();
}