I am trying to navigate back to a fragment of an activity from another activity. I have set 

```
 getActionBar().setDisplayHomeAsUpEnabled(true);

```

but whenever, I use the app back icon it always takes me to the first fragment of the activity rather than the fragment from which another activity was launched. How can I achieve this. I think I might have to implement

```
getSupportFragmentManager().popBackStack();

```

How can I do it?