有 fragment A 和 fragment B,其中 A 主要任务是从网页抓取信息,并显示在一个 textview 中。这个过程比较耗时所以单独用了一个线程然后更 UI 线程。
目前遇到的问题是,如果在 fragment A 抓取过程中,切换到 B,抓取任务就会中断。所以想求一个思路,怎么能保持抓取任务一直进行,!!! 并且能更新到 textview !!! 即使当前不在 fragment A 呢? 谢谢啦
有 fragment A 和 fragment B,其中 A 主要任务是从网页抓取信息,并显示在一个 textview 中。这个过程比较耗时所以单独用了一个线程然后更 UI 线程。
目前遇到的问题是,如果在 fragment A 抓取过程中,切换到 B,抓取任务就会中断。所以想求一个思路,怎么能保持抓取任务一直进行,!!! 并且能更新到 textview !!! 即使当前不在 fragment A 呢? 谢谢啦
|
KNOXMay 31, 2017 via Android
1
不要 replace,用 show and hide
|
|
Totato5749May 31, 2017
2
Service or IntentService + Broadcast receiver
|
|
3
|
|
lguipengMay 31, 2017
5
为什么后台任务需要 Fragment A !
|