Called From Wrong Thread Exception

前端 未结 2 1768
执笔经年
执笔经年 2021-01-27 10:53

I am getting an exception here when I try to bring another view to the front. It happens in the last method of my BoardView class where it says if(lives == 0). Can anybody see w

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-27 11:43

    You need to run the bring to front on the right thread. Try this:

    final View v = ((BoardView) getParent()).findViewById(1);
    v.post(new Runnable(){ public void run(){ v.bringToFront(); } });
    

    See if that works.

提交回复
热议问题