2016-01-20 27 views
-2

我想从网址下载图像http://dbh_cache.s3.amazonaws.com/19445/34173cb38f07f89ddbebc2ac9128303f-33b64a2ed0f1ff4750f183b4f2a161b8.png图像下载在android中不起作用。看起来像下划线不支持

看起来URL的域包含下划线,导致图像下载失败。请让我知道如果我是正确的

+4

如果您向我们展示如何下载图像,这将有所帮助。 –

+0

使用网络图像加载器类DisplayImageOptions activity_images_option = new DisplayImageOptions.Builder()。resetViewBeforeLoading(true) .cacheInMemory(true).showImageOnLoading(con.getResources()。getDrawable(R.drawable.image_placeholder)) .handler(new Handler ()) .cacheOnDisc(true).build(); ImageAware imageAware =新ImageViewAware(ImageView的,假); imageLoader.displayImage(path, –

+0

我也尝试了很多像picaso,volley和networkimageloader等其他sdk,但没有为我工作 –

回答

0

使用滑动这很简单。

将此添加到您的应用程序gradle。

compile 'com.github.bumptech.glide:glide:3.6.1' 

然后使用这一行代码。不需要添加异步任务。

Glide.with(context).load(ImageUrl) 
      .placeholder("drawable to show while loading image") 
      .error("drawable to show if loading image fails") 
      .into(imageView); 

有这么多东西,你可以用滑翔做检查这个Link

不要忘记权限添加到您的清单。

+0

下来选民能否请您解释一下我的理由,为什么你下来投票呢?这将在未来帮助我。 – Irfan