android - Create drawable from bitmap -
all,
as suggested here need make drawable out of bitmap. when tried use:
drawable d = new drawable( my_bmp); it shows constructor deprecated in favour of:
drawable(bitmap bmp, int resourceid) how else can make drawable out of bitmap?
thank you.
you can use
drawable d = new bitmapdrawable(getresources(), my_bmp); a drawable wraps bitmap , can tiled, stretched, or aligned. can create bitmapdrawable file path, input stream, through xml inflation, or bitmap object.
bitmapdrawable(resources res, bitmap bitmap)
create drawable bitmap, setting initial target density based on display metrics of resources.
also public constructors @
http://developer.android.com/reference/android/graphics/drawable/bitmapdrawable.html
Comments
Post a Comment