Add a public method in Activity, call the onNewIntent method in this method, and then call the method exposed by Activity through getActivity in Fragment. I'm a little curious, why are you actively calling the onNewIntent method?
En’s idea is wrong. This method doesn’t work because there are 4 Fragments in my mainActivity (FragmentA FragmentB FragmentC FragmentD). Among them, there are other ActivityA that need to jump to FragmentA. My previous idea was to jump directly to MainActivy and then from MainActivity. Control add or replace FragmentA, but there is a problem. There is a rollback stack in MainActivity (because the startup mode in MainActivity is Stand mode). So I set the startup mode in MainActivity to SingleTask. Now something goes wrong again. ActivityA cannot jump. In MainActivity, I re-created the OnnewIntent() method to solve the problem. However, FragmentC needs the data in A to update the view (FragmentC is a pie chart and cannot be updated in real time). I wonder if I can re-create the OnNewIntent() method. The view update method is done in this method. .
Your difficulty is that you need to update the data while the Activity jumps. The two can be processed separately. Use the regular one for Activity jump. Data updates can be monitored using third-party libraries such as EventBus.
Add a public method in Activity, call the onNewIntent method in this method, and then call the method exposed by Activity through getActivity in Fragment. I'm a little curious, why are you actively calling the onNewIntent method?
En’s idea is wrong. This method doesn’t work because there are 4 Fragments in my mainActivity (FragmentA FragmentB FragmentC FragmentD). Among them, there are other ActivityA that need to jump to FragmentA. My previous idea was to jump directly to MainActivy and then from MainActivity. Control add or replace FragmentA, but there is a problem. There is a rollback stack in MainActivity (because the startup mode in MainActivity is Stand mode). So I set the startup mode in MainActivity to SingleTask. Now something goes wrong again. ActivityA cannot jump. In MainActivity, I re-created the OnnewIntent() method to solve the problem. However, FragmentC needs the data in A to update the view (FragmentC is a pie chart and cannot be updated in real time). I wonder if I can re-create the OnNewIntent() method. The view update method is done in this method. .
Your difficulty is that you need to update the data while the Activity jumps. The two can be processed separately. Use the regular one for Activity jump. Data updates can be monitored using third-party libraries such as EventBus.