Iam loading images from the digital ocean spaces using aws s3 now its download the image to the local storage and then loading the image in image view but i need to load the image directly without downloading the image in local
My Current Code:
AmazonS3Client s3;
BasicAWSCredentials credentials;
TransferUtility transferUtility;
final TransferObserver observer,observers;
String key = "XXXXXXXX";
String secret = "XXXXXXXXXXXXX";
credentials = new BasicAWSCredentials(key, secret);
s3 = new AmazonS3Client(credentials);
s3.setEndpoint("https://xxx.yyyy.com");
transferUtility = new TransferUtility(s3, getApplicationContext());
CannedAccessControlList filePermission = CannedAccessControlList.PublicRead;
observer = transferUtility.download(
"xxx",
"xxxx/01.jpg",
new File("/storage/emulated/0/camera 1/05.jpg")
);
observer.setTransferListener(new TransferListener() {
@Override
public void onStateChanged(int id, TransferState state) {
if (state.COMPLETED.equals(observer.getState())) {
Toast.makeText(getApplicationContext(), "Space Download completed !!", Toast.LENGTH_LONG).show();
Bitmap bmp = BitmapFactory.decodeFile("/storage/emulated/0/camera 1/05.jpg");
imgview.setImageBitmap(bmp);
}
}
@Override
public void onProgressChanged(int id, long bytesCurrent, long bytesTotal) {
}
@Override
public void onError(int id, Exception ex) {
Toast.makeText(getApplicationContext(), "Space Download error: " + ex.getMessage(), Toast.LENGTH_LONG).show();
}
});