我用RAA对生产进行了数周的估算,在今天报告的一个奇怪错误之前,我有零的错误。
页: 1
android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
摘自这种方法(检索):
at my.app.CountdownFragment$1.void onPostExecute(java.lang.Object)(SourceFile:1)
这是相关的消息来源:
private void addInstructionsIfNeeded() {
if (S.sDisplayAssist) {
new AsyncTask<String, Void, String>() {
@Override
protected String doInBackground(String... params) {
return null;
}
/*
* runs on the ui thread
*/
protected void onPostExecute(String result) {
Activity a = getActivity();
if (S.sHelpEnabled && a != null) {
in = new InstructionsView(a.getApplicationContext());
RelativeLayout mv = (RelativeLayout) a
.findViewById(R.id.main_place);
mv.addView(in.prepareView());
}
};
}.execute("");
}
}
onPostExecute()
runs on the UI thread, so why I ve got "wrong thread"?- This code ran already on more than 150 devices, and more than 100000 times (according to Flurry), and never had this error.
- The originating device is Samsung SGH-I997 running SDK 4.0.4
我的问题是:怎么办?
EDIT: This all happens in a fragment