If I were asked to do it, I would do this, use EventBus, register the eventbus in another activity, and post the event in the current activity. The benefit of this is not only decoupling, but also when another activity is destroyed, you There will be many problems when operating the UI in another activity. Using eventbus, when another activity is destroyed, the event will not be received, and there will be no other UI operations.
This requirement can basically be realized by using startActivityForResult plus onActivityResult. The so-called "immediate" is the sensory feeling of human eye recognition delay. The download task is handed over to the background Service for hosting processing. Of course, eventbus and rxjava will feel lighter to implement, because they are encapsulated based on another mechanism
If I were asked to do it, I would do this, use EventBus, register the eventbus in another activity, and post the event in the current activity. The benefit of this is not only decoupling, but also when another activity is destroyed, you There will be many problems when operating the UI in another activity. Using eventbus, when another activity is destroyed, the event will not be received, and there will be no other UI operations.
This requirement can basically be realized by using startActivityForResult plus onActivityResult. The so-called "immediate" is the sensory feeling of human eye recognition delay. The download task is handed over to the background Service for hosting processing. Of course, eventbus and rxjava will feel lighter to implement, because they are encapsulated based on another mechanism