xamarin.android Android.Util.AndroidRuntimeException Message=Only the original thread that created a view hierarchy can touch its views.
Android.Util.AndroidRuntimeException
Message=Only the original thread that created a view hierarchy can touch its views.
错误产生原因,未在UI线程改变UI,导致出错。
xamarin.android 使用线程池处理耗时操作时,其UI更新应该回到UI线程再更新,处理方式如下:
ThreadPool.QueueUserWorkItem(thread => QueryBoxThread());
RunOnUiThread(() => {
lvAdapter.AddData(_boxLabel.ToString());
});
msdn参考链接:https://docs.microsoft.com/zh-cn/xamarin/android/app-fundamentals/writing-responsive-apps
*****有道无术,术尚可求;有术无道,止于术。*****