title: ActionBarActivity back button to fragment
body: <p>I have problem with the back button in action bar to fragment</p>
  
  <p>my code fragment: </p>
  
  <pre><code>public class Server extends Fragment {
  View view;
  
  @Nullable
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      view = inflater.inflate(R.layout.activity_server, container, false);
      Button server = (Button) view.findViewById(R.id.status);
  
      /** Button Check Status Server **/
      server.setOnClickListener(new View.OnClickListener() {
          public void onClick(View arg0) {
              Intent myIntent = new Intent(view.getContext(), ServerStatus.class);
              startActivityForResult(myIntent, 0);
              getActivity().finish();
          }
      });
      return view;
  }
  }
  </code></pre>
  
  <p>my code in activity:</p>
  
  <pre><code>public class ServerStatus extends ActionBarActivity {
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_server_status);
  }
  }
  </code></pre>
  
  <p>My code in Fragment </p>
  
  <pre><code>@Override
  public void onNavigationDrawerItemSelected(int position) {
      Fragment objFragment = null;
      switch (position) {
          case 0:
              objFragment = new Account();
              break;
          case 1:
              objFragment = new AllNews();
              break;
          case 2:
              objFragment = new Server();
              break;
          case 3:
              objFragment = new Account();
              break;
          case 4:
              objFragment = new Account();
              break;
          case 5:
              objFragment = new Account();
              break;
          case 6:
              objFragment = new About();
              break;
      }
      // update the main content by replacing fragments
      FragmentManager fragmentManager = getSupportFragmentManager();
      fragmentManager.beginTransaction()
              .replace(R.id.container,objFragment)
              .commit();
  }
  </code></pre>
  
  <p>Every time I click the back button, the program always closes. I already tried to use:</p>
  
  <pre><code>getActionBar().setDisplayHomeAsUpEnabled(true);
  </code></pre>
  
  <p>and this: </p>
  
  <pre><code>@Override
  public boolean onOptionsItemSelected(MenuItem item) {
  switch (item.getItemId()) {
  // Respond to the action bar's Up/Home button
  case android.R.id.home:
      NavUtils.navigateUpFromSameTask(this);
      return true;
  }
  return super.onOptionsItemSelected(item);
  }
  </code></pre>
  
  <p>Can anyone help me to fix my program?</p>