How to load image from aws with picasso with private access

后端 未结 4 1004
广开言路
广开言路 2021-02-09 00:11

I\'m trying to load image stored on aws S3 into my android app using Picasso but I am getting a blank image with no errors in my logcat and nothing to me from general debugging

4条回答
  •  情书的邮戳
    2021-02-09 00:41

    write below code to load image in Picasso. 
    variables:-  
    String file_path                          -->> this is your image file path 
    Imageview mViewHolder.img_post_photo      -->> this is your imageview to load image.
    
                            Picasso.with(context)
                                    .load(file_path)
                                    .placeholder(R.mipmap.ic_launcher)
                                    .error(R.mipmap.ic_launcher)
                                    .into(mViewHolder.img_post_photo, new Callback() {
                                        @Override
                                        public void onSuccess() {
    
                                        }
    
                                        @Override
                                        public void onError() {
                                            Picasso.with(context)
                                                    .load(file_path)
                                                    .placeholder(R.mipmap.ic_launcher)
                                                    .error(R.mipmap.ic_launcher)
                                                    .into(mViewHolder.img_post_photo);
                                        }
                                    });
    
    Set dependencies in your app build.gradle file:-
    compile 'com.squareup.picasso:picasso:2.5.2'
    
    hope this code helps you.
    

提交回复
热议问题