@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    SharedPreferences.Editor editor = settings.edit();
    boolean check;
    int color;

    /* resultCode must equal RESULT_CANCELED because the only way
     * out of that activity is pressing the back button on the phone
     * this publishes a canceled result code not an ok result code
     */
    if (requestCode == SETTING_REQ && resultCode == RESULT_CANCELED) {
      // save the information we get from settings activity
      check = data.getBooleanExtra("HIDDEN", false);
      color = data.getIntExtra("COLOR", -1);

      editor.putBoolean(PREFS_HIDDEN, check);
      editor.putInt(PREFS_COLOR, color);
      editor.commit();

      flmg.setShowHiddenFiles(check);
      handler.setTextColor(color);
      handler.updateDirectory(flmg.getNextDir(flmg.getCurrentDir(), true));
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.main);

    /*read settings*/
    settings = getSharedPreferences(PREFS_NAME, 0);
    boolean hide = settings.getBoolean(PREFS_HIDDEN, false);
    int color = settings.getInt(PREFS_COLOR, -1);

    flmg = new FileManager();
    flmg.setShowHiddenFiles(hide);

    handler = new EventHandler(Main.this, flmg);
    handler.setTextColor(color);
    table = handler.new TableRow();

    /*sets the ListAdapter for our ListActivity and
     *gives our EventHandler class the same adapter
     */
    handler.setListAdapter(table);
    setListAdapter(table);

    /* register context menu for our list view */
    registerForContextMenu(getListView());

    path_label = (TextView) findViewById(R.id.path_label);
    detail_label = (TextView) findViewById(R.id.detail_label);
    path_label.setText("path: /sdcard");

    handler.setUpdateLabel(path_label, detail_label);

    ImageButton help_b = (ImageButton) findViewById(R.id.help_button);
    help_b.setOnClickListener(handler);

    ImageButton home_b = (ImageButton) findViewById(R.id.home_button);
    home_b.setOnClickListener(handler);

    ImageButton back_b = (ImageButton) findViewById(R.id.back_button);
    back_b.setOnClickListener(handler);

    ImageButton info_b = (ImageButton) findViewById(R.id.info_button);
    info_b.setOnClickListener(handler);

    ImageButton manage_b = (ImageButton) findViewById(R.id.manage_button);
    manage_b.setOnClickListener(handler);

    ImageButton multi_b = (ImageButton) findViewById(R.id.multiselect_button);
    multi_b.setOnClickListener(handler);

    ImageButton operation_b = (ImageButton) findViewById(R.id.multioperation_button);
    operation_b.setOnClickListener(handler);
  }