My application shows a lot of images on the main screen. The user can view additional product information by clicking on the image. The main screen fragment is hidden, and the product part fragment becomes visible. By clicking on the back button, a fragment of the main screen will again become visible.
The fragment transaction is implemented as follows:
@Override
public void showProduct(Product p, boolean isParentTabbed) {
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction transaction = fm.beginTransaction();
Fragment mFragment = new ProductDetailFragment(p,isParentTabbed);
transaction.hide(currentlyOpenedFragment);
transaction.add(android.R.id.content,mFragment);
currentlyOpenedFragment = mFragment;
transaction.setCustomAnimations(R.anim.slide_in_bottom, R.anim.slide_out_top);
transaction.addToBackStack(null);
transaction.commit();
}
, , ( share android) , "". - onResume ( ).
, onResume :
super.onResume();
if(this.isHidden()){
Log.d("tab","dont resume tab0fragment because it is hidden");
return;
}
, : onResume() , ?