2017-02-15 3 views

ответ

1

Вы можете попробовать этот способ:

Glide.with(this) 
     .load(Uri.fromFile(new File(url))) 
     .asBitmap() 
     .into(new SimpleTarget<Bitmap>() { 
      @Override 
      public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { 
      bitmapByGlide = resource; 
      } 
     }); 

(используйте Uri.formFile() является трюком этого)

0

Попробуйте это.

Glide.with(this) 
      .load(url) 
      .asBitmap() 
      .into(new SimpleTarget<Bitmap>() { 
       @Override 
       public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { 

       } 
      }); 
0
private SimpleTarget target = new SimpleTarget<Bitmap>() { 
    @Override 
    public void onResourceReady(Bitmap bitmap, GlideAnimation glideAnimation) { 
     // do something with the bitmap 
     // for demonstration purposes, let's just set it to an ImageView 
     imageView1.setImageBitmap(bitmap); 
    } 
}; 

private void loadImageSimpleTarget() { 
    Glide 
     .with(context) // could be an issue! 
     .load(eatFoodyImages[0]) 
     .asBitmap() 
     .into(target); 
} 

Источник: https://futurestud.io/tutorials/glide-callbacks-simpletarget-and-viewtarget-for-custom-view-classes

0

попробовать это:

File b = new File(Environment.getExternalStorageDirectory(), "DCIM/Camera/IMG_20150828_174009.jpg"); 

и

 Glide.with(MainActivity.this).load(b).error(R.drawable.empty_pic).placeholder(R.drawable.empty_pic).into(image2); 
Смежные вопросы