Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void dialogSettings() {
- final Dialog dialog = new Dialog(this, R.style.dialog_style);
- dialog.setContentView(R.layout.dialog_settings);
- final CheckBox sound = (CheckBox) dialog.findViewById(R.id.checkBoxSound);
- final CheckBox vibration = (CheckBox) dialog.findViewById(R.id.checkBoxVibration);
- final SharedPreferences pref = getSharedPreferences("SETTINGS", 0);
- sound.setChecked(pref.getBoolean("SOUND", true));
- vibration.setChecked(pref.getBoolean("VIBRATION", true));
- Button buttonSave = (Button) dialog.findViewById(R.id.buttonSave);
- buttonSave.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- SharedPreferences.Editor editor = pref.edit();
- editor.putBoolean("SOUND", sound.isChecked());
- editor.putBoolean("VIBRATION", vibration.isChecked());
- editor.commit();
- dialog.dismiss();
- }
- });
- dialog.show();
- }
- private boolean SOUND;
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.game_normal_layout);
- SharedPreferences pref = getSharedPreferences("SETTINGS", 0);
- SOUND = pref.getBoolean("SOUND", true);
- ....
- }
- private void evaluateAnswer() {
- if(correct) {
- if(SOUND) { // LINE 259
- ding.seekTo(0);
- ding.start();
- }
- ...
- }
- java.lang.NullPointerException
- at mindmApp.quiz.GameNormalActivity.evaluateAnswer(GameNormalActivity.java:259)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement