Introduction - If you have any usage issues, please Google them yourself
BitMap, View and Canvas is we use class often Ophone program. This day to feisky study notes appear, through the examples explain View&Canvas and so on.
1. Get a bitmap from resources
Can use BitmapDrawable or BitmapFactory to obtain resources of the bitmap.
Of course, we first need to obtain resources:
Resources res = getResources ()
Use BitmapDrawable get a bitmap
Use BitmapDrawable (InputStream is constructing a BitmapDrawable
Use BitmapDrawable kind getBitmap () get get a bitmap
//read InputStream and get a bitmap
InputStream is = res. OpenRawResource (R.d rawable. Pic180)
BitmapDrawable bmpDraw = new BitmapDrawable (is)
Bitmap BMP = bmpDraw. GetBitmap ()
Or use the following ways: