如何在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
}

希望你会得到你想要的

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...