I am studying Android development for Sams Android Development in 24 hours. I am implementing a game called theredone that contains the following activities:
quizactivity
, splashactivity
, gameactivity
, menuactivity
, settingsactivity
, helpactivity
. splashactivity
extends quizactivity
while quizactivity
extends Activity
.
I implemented SharedPreferences
in quizactivity.java
.
package com.androidbook.triviaquiz6;
import android.app.Activity;
import android.content.SharedPreferences;
public class QuizActivity extends Activity {
public static final String GAME_PREFERENCES = "GamePrefs";
private SharedPreferences myPrefs; //Syntax error on token ";", { expected after this token -//----------------------------
myPrefs = Actionactivity.this.getSharedPreferences("myPrefs", MODE_WORLD_WRITEABLE);
SharedPreferences.Editor prefsEditor = myPrefs.edit();
prefsEditor.putString("key name", "key valuse");
prefsEditor.commit();
//this one to read data
myPrefs = this.getSharedPreferences("myPrefs", MODE_WORLD_READABLE);
myPrefs.getString("key name", "") ;
}//Syntax error, insert "}" to complete ClassBody -----------------------
could you help me out please i dont think its a dumb qs