Picasso java.lang.IllegalStateException: Method call should not happen from the main thread

后端 未结 5 2005
后悔当初
后悔当初 2021-01-07 22:32

I am attempting to use Picasso to get three Bitmap images from a URL

public void onCreate(Bundle savedInstanceState) { 
  super.onC         


        
5条回答
  •  离开以前
    2021-01-07 23:35

    None of above worked for me instead this

    Handler uiHandler = new Handler(Looper.getMainLooper());
        uiHandler.post(new Runnable(){
            @Override
            public void run() {
                Picasso.with(Context)
                        .load(imageUrl)
                        .into(imageView);
            }
        });
    

    Hope it may be useful for someone

提交回复
热议问题