Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 是否从SurfaceView线程更新EditText LayoutParams?_Android_Multithreading_Android Edittext_Surfaceview_Layoutparams - Fatal编程技术网

Android 是否从SurfaceView线程更新EditText LayoutParams?

Android 是否从SurfaceView线程更新EditText LayoutParams?,android,multithreading,android-edittext,surfaceview,layoutparams,Android,Multithreading,Android Edittext,Surfaceview,Layoutparams,我在onCreate的主活动中创建了一个EditText对象。我需要能够从SurfaceView线程更改布局参数。目前我遇到以下错误: android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. 我还尝试从UIHandler设置布局参数,但得到了相同的错误。我对Android开发真的很陌生,所以如

我在onCreate的主活动中创建了一个EditText对象。我需要能够从SurfaceView线程更改布局参数。目前我遇到以下错误:

android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.

我还尝试从UIHandler设置布局参数,但得到了相同的错误。我对Android开发真的很陌生,所以如果有任何建议,我将不胜感激。谢谢

通常,您可以使用
runOnUiThread
从其他线程更新UI。e、 g

runOnUiThread(new Runnable() {
  public void run() {
    textView.setText("Hello");
  }
});

通常,您可以使用
runOnUiThread
从其他线程更新UI。e、 g

runOnUiThread(new Runnable() {
  public void run() {
    textView.setText("Hello");
  }
});