본문 바로가기
Programming/Android

Bitmap Drawable 변환

Bitmap Drawable 변환


Bitmap bitmap = BitmapFactory.decodeFile(“/sdcard/test.jpg”);

Drawable drawable = new BitmapDrawable(bitmap);

 

 

비트맵을 Drawble로 변환시

 

Public Constructors
BitmapDrawable()
This constructor was deprecated in API level 4. Use BitmapDrawable(Resources) to ensure that the drawable has correctly set its target density.
BitmapDrawable(Resources res)
Create an empty drawable, setting initial target density based on the display metrics of the resources.
BitmapDrawable(Bitmap bitmap)
This constructor was deprecated in API level 4. Use BitmapDrawable(Resources, Bitmap) to ensure that the drawable has correctly set its target density.
BitmapDrawable(Resources res, Bitmap bitmap)
Create drawable from a bitmap, setting initial target density based on the display metrics of the resources.
BitmapDrawable(String filepath)
This constructor was deprecated in API level 5. Use BitmapDrawable(Resources, String) to ensure that the drawable has correctly set its target density.
BitmapDrawable(Resources res, String filepath)
Create a drawable by opening a given file path and decoding the bitmap.
BitmapDrawable(InputStream is)
This constructor was deprecated in API level 5. Use BitmapDrawable(Resources, java.io.InputStream) to ensure that the drawable has correctly set its target density.
BitmapDrawable(Resources res, InputStream is)
Create a drawable by decoding a bitmap from the given input strea

 

출처 : http://developer.android.com/reference/android/graphics/drawable/BitmapDrawable.html