android - 如何通过点击当前fragment的某个按钮然后几乎同时在另一个fragment的listview上添加一个数据?
巴扎黑
巴扎黑 2017-04-17 15:29:50
0
2
410

如题...
如何通过点击当前fragment的某个按钮然后几乎同时在另一个fragment的listview上添加一个数据?这两个fragment均是不同的activity托管的...这就像酷狗音乐的下载,点击了下载然后下载页面就会多一个数据...

巴扎黑
巴扎黑

reply all(2)
阿神

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template