I'm not able to figure out this problem. I'm using ActionBarSherlock in my application which consists of two fragments inside the main activity.Each fragment consists of a list populated from database. Everything else is working fine. There seems to be a problem with the back button. Ideally it should terminate the application but in my case when I press the back button from within a fragment,instead of exiting the application it shows the fragment with an empty list and I have to press the back button again to terminate the application. I read this post but am not able to figure out how to resolve this problem. Fragment: which callback invoked when press back button & customize it Please help!!
protected class MyTabListener implements ActionBar.TabListener
{
Fragment fragment;
public MyTabListener( Fragment fragment) {
// TODO Auto-generated constructor stub
this.fragment=fragment;
}
public void onTabSelected(Tab tab, FragmentTransaction ft) {
// TODO Auto-generated method stub
ft.replace(R.id.fragment_place,fragment,null);
}
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
// TODO Auto-generated method stub
ft.remove(fragment);
}
public void onTabReselected(Tab tab, FragmentTransaction ft) {
// TODO Auto-generated method stub
}
}