简体   繁体   中英

onPress of back button from settings it returns to home screen not the current activity

What is happening:

  • I am in my app screen, it is a fragment residing in a activity
  • I receive the message, i open the message by going to inbox
  • now i press back, now it takes me to my home screen

note: I can see the app running in the background

What i am trying to do:

I want to go to by fragment on press of back from settings screen

Code i use to start the current fragment was:

ft = getActivity().getSupportFragmentManager().beginTransaction();
                    FrgOtp fragment2 = FrgOtp.newInstance(phoneNumber);  
                    ft.hide(FrgLogin.this);
                    ft.replace(R.id.container, fragment2, FrgOtp.class.getSimpleName()).addToBackStack(FrgOtp.class.getSimpleName()).commit();

manifest

   <activity
            android:name="com.windhyaworks.activities.ActLogin"
            android:configChanges="orientation|keyboardHidden"
            android:screenOrientation="portrait"
            android:theme="@style/AppTheme" />
        <activity

您是否尝试过ft.addtobackstack()?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM