728x90

Context mContext;
ImageView mImage = (ImageView) findViewById(R.id.croppedImageView);

String imageUri = Item.getPhoto();
if (imageUri.equals("")) { // 이미지가 없을 때
    int resourceId = R.drawable.photo_base;
    Glide.with(mContext).load(resourceId).into(mImage);
} else { // 이미지가 있을 때
    Glide.with(mContext).load(imageUri).into(mImage);
}


imageUri 는 실제 파일이 존재하는 경로, 예) http://www.abc.com/images/abc.jpg


폰의 폴더에 있는 이미지를 View 할 때

String croppedFolderName = "/DCIM/PhotoTemp";
File outputFile = null;
String outputFileName="myprofile.jpg";
private ImageView imageView;

File path = new File(Environment.getExternalStorageDirectory() + croppedFolderName);
if (! path.exists())
    path.mkdirs(); // 디렉토리가 없으면 생성
outputFile = new File(path, outputFileName);

Bitmap photoBitmap = BitmapFactory.decodeFile(outputFile.getAbsolutePath() );
imageView.setImageBitmap(photoBitmap);


Glide 로 View 하면

String imageUri = outputFile.getAbsolutePath();
Glide.with(context).load(imageUri).into(imageView);

블로그 이미지

Link2Me

,