android - Issue with back button between Fragments (backstack) -


i have app 3 tabs. 2 of theese tabs have buttons change current fragment new 1 code:

mapfragment newfragment = new journeymapfragment(mcontext, getfromdestinationcoordinate(), gettodestinationcoordinate());                 android.app.fragmenttransaction transaction = getfragmentmanager().begintransaction();                 transaction.setcustomanimations(android.r.animator.fade_in,                         android.r.animator.fade_out);                  // replace whatever in fragment_container view fragment,                 // , add transaction stack                 transaction.replace(r.id.fragment_container, newfragment);                 transaction.addtobackstack(null);                  if(newfragment.ishidden()){                     transaction.show(newfragment);                 }                  transaction.commit(); 

for on of tabs normal fragment, changing map fragment button takes me original fragment no issuse.

however, tab mapfragment, changing normal fragment not give me same action when pressing button. when it's pressed changes view white/black view.

this transaction code within tab button won't work:

                        fragment newfragment = new closebusstopfragment(mcontext, busstoplist, getmyposition());                         android.app.fragmenttransaction transaction = getfragmentmanager().begintransaction();                         transaction.setcustomanimations(android.r.animator.fade_in,                                 android.r.animator.fade_out);                          // replace whatever in fragment_container view fragment,                         // , add transaction stack                         transaction.replace(r.id.fragment_container, newfragment);   transaction.addtobackstack(null);                      if(newfragment.ishidden()){                         transaction.show(newfragment);                     }                         // commit transaction                         transaction.commit(); 

anyone know why happens? help?

if can manually, can try overriding onbackpressed() , whatever want manually.

   @override    public void onbackpressed() {                    // whatever transaction manually         super.onbackpressed();      } 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -