Android-Glide无法加载图片

时间:2018-11-16 07:58:26

标签: android-studio android-glide image-loading

我正在尝试通过glide库将图像加载到图像视图中,但是每当我运行该应用程序时,图像视图将变为空白并且日志显示无法加载资源

dp = view.findViewById(R.id.circleView);

  GlideApp
                                 .with(getActivity())
                                 .load(serverResponse.getMessage().getPic())//C:/Apache24/htdocs/app2/User Files/User Id-102/User id 102.jpg
                                 .listener(new RequestListener<Drawable>() {
                                     @Override
                                     public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
                                         // log exception
                                         Toast.makeText(getActivity(), "Error loading image", Toast.LENGTH_SHORT).show();
                                         Log.v("glide", "Error loading image", e);
                                         return false; // important to return false so the error placeholder can be placed
                                     }

                                     @Override
                                     public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
                                         return false;
                                     }
                                 })
                                 .into(dp);

日志

 2018-11-02 19:20:08.709 31664-31664/com.example.user.myapplication W/Glide: Load failed for C:/Apache24/htdocs/app2/User Files/User Id-102/User id 102.jpg with size [200x200]
    class com.bumptech.glide.load.engine.GlideException: Failed to load resource
2018-11-02 19:20:08.718 31664-31664/com.example.user.myapplication V/glide: Error loading image
    class com.bumptech.glide.load.engine.GlideException: Failed to load resource

我实际上无法确定发生错误的位置。任何帮助将不胜感激。

预先感谢

0 个答案:

没有答案