1. If it is a constant, you can write a Constant class to store it specifically. 2. You can open the activity in sequence through startActivityForResult. When returning, you can judge and transfer it in onActivity based on the data in the Intent, requestCode, and resultCode, but the code is definitely not refreshing enough.
The requirements are not particularly clear. The scenario is very similar to the login and registration scenario: click on the login page, forget the password, then complete the operation and return directly to complete the login.
If BC does not have any interaction requirements when returning, and there are no special requirements for A, then just implement launchMode设置成singleInstance or singleTop(处理和前者不一样)结合Activity#onNewIntent(...)
If you have any interaction requirements, just return level by level.
In addition, you can also use the EventBus library directly (EventBus, otto, RxBus都是可以的, 可以使用EventBus的场景也可以考虑使用LocalBroadcastManager), but you need to consider what happens if A is recycled by the system.
p.s. Just eliminate the need for static global methods....
A library that uses event bus, it is recommended to use Eventbus
Benefits:
Serialization of the passed data is not needed
Use observer pattern to decouple
1. If it is a constant, you can write a Constant class to store it specifically.
2. You can open the activity in sequence through startActivityForResult. When returning, you can judge and transfer it in onActivity based on the data in the Intent, requestCode, and resultCode, but the code is definitely not refreshing enough.
If BC does not have any interaction requirements when returning, and there are no special requirements for A, then just implement
launchMode
设置成singleInstance
orsingleTop
(处理和前者不一样)结合Activity#onNewIntent(...)
If you have any interaction requirements, just return level by level.
In addition, you can also use the EventBus library directly (
EventBus
,otto
,RxBus
都是可以的, 可以使用EventBus的场景也可以考虑使用LocalBroadcastManager
), but you need to consider what happens if A is recycled by the system.p.s. Just eliminate the need for static global methods....