Android “Only the original thread that created a view hierarchy can touch its views.”

后端 未结 28 3360
鱼传尺愫
鱼传尺愫 2020-11-21 04:44

I\'ve built a simple music player in Android. The view for each song contains a SeekBar, implemented like this:

public class Song extends Activity implement         


        
28条回答
  •  忘掉有多难
    2020-11-21 05:17

    If you simply want to invalidate (call repaint/redraw function) from your non UI Thread, use postInvalidate()

    myView.postInvalidate();
    

    This will post an invalidate request on the UI-thread.

    For more information : what-does-postinvalidate-do

提交回复
热议问题