微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在Android中加载URL图像?

现在我正在使用Glide-library来加载 Android Wear中的图像.大多数时候它不会加载图像.但是,它有时会加载图像.不知道我的代码出了什么问题.

注意Wear通过蓝牙连接到设备,我通过移动的broadcast Receiver从Android Wear中成功获得了Web服务的JSON响应.除了图像外,所有数据均正常显示.

Glide.with(mContext)
   .load("http://www.hanamoflorist.ca/images/uploads/Spring5InchesCubeVaseArrangement$45.00.jpg")
      .listener(new RequestListener<String,GlideDrawable>() {

        @Override
        public boolean onException(Exception e,String model,Target<GlideDrawable> target,boolean isFirstResource) {
            Log.e("exception in image","" + e);
            Toast.makeText(mContext,"" + e,Toast.LENGTH_LONG).show();
            return false;
        }

        @Override
        public boolean onResourceReady(GlideDrawable resource,boolean isFromMemoryCache,boolean isFirstResource) {
            return false;
        }
    }).error(R.drawable.ic_placeholder_image)
        .into(((ItemViewHolder) holder).ivCardImage);

解决方法

我想你应该使用,DaVinci在穿戴式的图像加载,
DaVinci.with(context).load("Your Url").into(imageView);

确保使用与库相同的播放服务版本,

你可以把它加入到你的毕业生中:

穿:

compile ('com.github.florent37:davinci:1.0.3@aar'){
    transitive = true
}

移动:

compile ('com.github.florent37:davincidaemon:1.0.3@aar'){
     transitive = true
}

希望你会得到你想要的

原文地址:https://www.jb51.cc/android/310969.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐