byte[]转换为Drawable

(written at 2013-02-20 19:07:23


byte[] photoByte = contacts.get(position).getPhoto();
//Log.e("photo", "photo is " + photoByte);
if(photoByte!=null && !photoByte.equals("")){
//Contact对象的图像
     Bitmap map = BitmapFactory.decodeByteArray(photoByte, 0, photoByte.length);
     BitmapDrawable bd=new BitmapDrawable(map);
     iv.setBackgroundDrawable(bd);             
}else{
     iv.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.profile_big));
}


你可能感兴趣的:(Android)