Android - ViewRootImpl$CalledFromWrongThreadException

前端 未结 4 1260
有刺的猬
有刺的猬 2020-11-30 12:28

I was using this, to DISPLAY IMAGES FROM THE INTERNET but it throws an error as below:
04-12 13:45:05.337: E/AndroidRuntime(27897): Caused by: android.view.View

4条回答
  •  失恋的感觉
    2020-11-30 12:39

    If you would like to do this job in fragment, you should call UI thread from activity in fragment.

    getActivity().runOnUiThread(new Runnable() {
      public void run(){
    
        ... //your job 
    
      }
    });
    

    @canerkaseler

提交回复
热议问题