Error in Xamarin Android with a progress dialog “Only the original thread that created a view hierarchy can touch its views”

后端 未结 4 1398
醉酒成梦
醉酒成梦 2021-01-25 08:01

I\'m trying to use a progress dialog, while filling a datagrid, but I get the following error: \"Only the original thread that created a view hierarchy can touch its views\", th

4条回答
  •  甜味超标
    2021-01-25 08:48

    The error is telling you the app's UI must be handled by the main thread. In your code, you are running some code on a background thread (ThreadPool.QueueUserWorkItem) that needs to be run on the UI thread (RunOnUiThread) instead.

提交回复
热议问题