问题:TabActivity-增加没有标签之前的人际关已经完成了
-
25-09-2019 - |
题
我有一个TabActivity执行TabContentFactory,开始际关在onCreate()获取数据的标签。当际关已经完成,onPostExecute()可能直接更新的用户界面的因素,对吗?意义,因为该方法的用户界面的线没有进一步的线-同步将需要时访问UI-元素呢?
无论如何,我的问题是,我UI-线电话createTabContent()在TabActivity而际关仍然是繁忙。我已添加至少一个标签,或者我得到一个异常.但我怎么才添加标签的时候我的人际关已经完成和ProgressDialog已经驳回了?
我很乐意,如果有人可以帮助...
解决方案
When the AsyncTask has finished, onPostExecute() could directly update the
UI-elements, right? Meaning, since that method runs in the UI-Thread no further
thread-synchronization would be required when accessing UI-elements?
正确的。
Anyway, the problem I have is that my UI-Thread calls createTabContent() in the
TabActivity while the AsyncTask is still busy.
如果你需要更新UI而际关仍在运行的背景,然后替代际关.onProgressUpdate(..)和然后打电话给际关.publishProgress(..)从内的人际关.域会被名为doinbackground(..).
I have to add at least one tab, or I get a NullPointerException. But how do I
only add tabs when my AsyncTask has finished and the ProgressDialog has been
dismissed?
我不明白这一点。你可以请更详细地解释?
无论如何,看这件事:
- 开始际关只有在TabActivity是完全建立。启动它从onPostCreate()而不是onCreate().这可能是你的异常.
- 你可以更新的任何活动,从UI线内的人际关.onPostExecute(..)
- 如果你需要更新UI而际关仍在运行的背景,然后打电话给际关.publishProgress(..)从内的人际关.域会被名为doinbackground(..)
不隶属于 StackOverflow