public void back() {
    hideKeyboard();
    try {
      // if we set history.size() > 0 and we press back key on home
      // activity
      // and then on another activity we wont get back!
      if (history.size() > 1) {
        history.remove(history.size() - 1);
        // call the super.setContent view! so set the real view
        super.setContentView(history.get(history.size() - 1));
      } else {

      }
    } catch (Exception e) {
      if (history.size() >= 0) super.setContentView(history.get(0));
    }
  }
 private void replaceView(View view) {
   // Adds the old one to history
   history.add(view);
   // changes this group view to the new view
   super.setContentView(view);
 }