How to load image from aws with picasso with private access

寵の児 提交于 2019-12-03 08:40:56

Simply use this:

Picasso.with(getApplicationContext()).load(your_url).noFade().into(imageView);
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.

You need to generate a presigned Url from S3 client and you can pass that url to picasso. That url will be public and will have an expriy date.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!