public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case TOGGLE_SOUND:
       String soundEnabledText = "Sound On";
       if (soundEnabled) {
         soundEnabled = false;
         myWhackAMoleView.soundOn = false;
         soundEnabledText = "Sound Off";
       } else {
         soundEnabled = true;
         myWhackAMoleView.soundOn = true;
       }
       DatabaseAdapter db = new DatabaseAdapter(this);
       try {
         db.open();
       } catch (SQLException sqle) {
         throw sqle;
       }
       db.insertOrUpdateRecord(Boolean.toString(soundEnabled));
       db.close();
       // SharedPreferences settings = getSharedPreferences(PREFERENCES_NAME, 0);
       // SharedPreferences.Editor editor = settings.edit();
       // editor.putBoolean("soundSetting", soundEnabled);
       // editor.commit();
       // writeXML();
       Toast.makeText(this, soundEnabledText, Toast.LENGTH_SHORT).show();
       break;
   }
   return false;
 }
 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   requestWindowFeature(Window.FEATURE_NO_TITLE);
   getWindow()
       .setFlags(
           WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
   setContentView(R.layout.whackamole_layout);
   myWhackAMoleView = (WhackAMoleView) findViewById(R.id.mole);
   myWhackAMoleView.setKeepScreenOn(true);
   setVolumeControlStream(AudioManager.STREAM_MUSIC);
   DatabaseAdapter db = new DatabaseAdapter(this);
   try {
     db.open();
   } catch (SQLException sqle) {
     throw sqle;
   }
   Cursor c = db.getRecord(1);
   startManagingCursor(c);
   if (c.moveToFirst()) {
     do {
       soundEnabled = Boolean.parseBoolean((c.getString(1)));
     } while (c.moveToNext());
   }
   db.close();
   // SharedPreferences settings = getSharedPreferences(PREFERENCES_NAME, 0);
   // soundEnabled = settings.getBoolean("soundSetting", true);
   /*
   try {
   	readXML();
   } catch (XmlPullParserException e) {
   	e.printStackTrace();
   } catch (IOException e) {
   	e.printStackTrace();
   }
   */
   myWhackAMoleView.soundOn = soundEnabled;
 }