aSyncTask 在 Nexus S 上崩溃,但在 Droid 1 上不崩溃
我有一个用于加载屏幕的 aSyncTask。在我的 doBackground 中,我必须
mCampusMap = (CampusMap) findViewById(R.id.CampusMap);
mCampusMap.setVisibility(View.VISIBLE);
启动 openGL 视图,该视图需要 5 秒左右的时间来加载。
在 Droid 上一切正常,但在 Nexus S 上我收到以下错误:
10-05 17:56:02.906: ERROR/AndroidRuntime(876): Caused by: android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
I have an aSyncTask used for a loading screen. In my doBackground, I have
mCampusMap = (CampusMap) findViewById(R.id.CampusMap);
mCampusMap.setVisibility(View.VISIBLE);
to fire up my openGL View which takes 5 seconds or so to load.
Everything works fine on the Droid, but on a Nexus S i get the following error:
10-05 17:56:02.906: ERROR/AndroidRuntime(876): Caused by: android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您在 Activity 类中定义 AsyncTask 类,请尝试以下操作:
If you define the AsyncTask class inside your Activity class, try this: