public void deleteAllSaveGames() {
    File dir = new File(SAVEGAME_DIR);
    String[] allFiles = dir.list();
    for (String entryName : allFiles)
      if (entryName.startsWith("savegame_")) new File(dir + "/" + entryName).delete();
    mAdapter.refreshFiles();
    mAdapter.notifyDataSetChanged();

    discardButton.setEnabled(false);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (!PreferenceManager.getDefaultSharedPreferences(this).getBoolean("showfullscreen", false))
      this.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    else this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

    setContentView(R.layout.activity_savegame);
    final Button saveButton = (Button) findViewById(R.id.savebutton);
    discardButton = (ImageButton) findViewById(R.id.discardbutton);
    empty = (TextView) findViewById(android.R.id.empty);
    saveGameList = (ListView) findViewById(android.R.id.list);

    String themePref =
        PreferenceManager.getDefaultSharedPreferences(this).getString("alternatetheme", "0");
    int theme = Integer.parseInt(themePref);
    this.findViewById(R.id.saveGameContainer).setBackgroundColor(MainActivity.BG_COLOURS[theme]);
    /*if (theme == GridView.THEME_LIGHT)
    	saveButton.setTextColor(R.drawable.text_button);
    if (theme == GridView.THEME_DARK)
    	saveButton.setTextColor(R.drawable.text_button_dark);
     */
    saveButton.setTextColor(MainActivity.TEXT_COLOURS[theme]);

    saveGameList.setEmptyView(empty);
    this.mAdapter = new SaveGameListAdapter(this);
    saveGameList.setAdapter(this.mAdapter);

    saveButton.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            saveButton.setEnabled(false);
            currentSaveGame();
          }
        });

    if (this.mCurrentSaved) saveButton.setEnabled(false);

    discardButton.setEnabled(false);
    if (mAdapter.getCount() != 0) discardButton.setEnabled(true);

    discardButton.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            deleteAllGamesDialog();
          }
        });
  }
 public void deleteSaveGame(final String filename) {
   new File(filename).delete();
   mAdapter.refreshFiles();
   mAdapter.notifyDataSetChanged();
 }