Download Images From URL to SD Card

前端 未结 5 400
不知归路
不知归路 2020-12-14 13:12

I am trying to create a very simple Image Downloading app. in which i want to download all images from this url to sd card: https://www.dropbox.com/sh/5be3kgehyg8uzh2

5条回答
  •  春和景丽
    2020-12-14 14:07

    Using picasso to save images in sd card, you can do something like following

    private Target mTarget = new Target() {
          @Override
          public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
              // Perform simple file operation to store this bitmap to your sd card
          }
    
          @Override
          public void onBitmapFailed(Drawable errorDrawable) {
          }
    
          @Override
          public void onPrepareLoad(Drawable placeHolderDrawable) {
          }
    }
    
    ...
    
    Picasso.with(this).load("url").into(mTarget);
    

    Here "Target" is a class provided by picasso, and it has very simple method to understand...
    Hope this will meet your needs

提交回复
热议问题