在我的应用程序中,我重复一个AysnceTask,它从我的AWS桶下载图像,但是它们需要一点点下载(通常是1/2秒),当我下载10张图片时,它会加起来,使用户的体验更糟。
我的问题是:是否有更快的方法从AWS S3下载图像?
Android代码:
private class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
protected Bitmap doInBackground(String... urls) {
String PhotoURL = "https://s3.amazonaws.com/bucket/Images/" + productForImages;
Bitmap mIcon11 = null;
try {
InputStream in = new java.net.URL(PhotoURL).openStream();
mIcon11 = BitmapFactory.decodeStream(in);
} catch (Exception e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
return mIcon11;
}
protected void onPostExecute(Bitmap result) {
productColumn = 5;
productImages[productRow][productColumn] = result;
}
}使用不同的服务(如AWS)、GitHub或其他库来加速下载是可能的!
https://stackoverflow.com/questions/38364755
复制相似问题