I have a class that extends BitmapDrawable that looks like this:
public class MyDrawable extends BitmapDrawable {
protected Drawable drawable;
@Override
public void draw(Canvas canvas) {
if(drawable != null) {
drawable.draw(canvas);
}
}
// some other methods...
}
and Eclipse warns me that constructor BitmapDrawable() is deprecated. Everything is working just fine but I would like to fix my class so I don't get this message.
Any help is appreciated.
Currently your class has the default constructor MyDrawable() that calls BitmapDrawable(), which is deprecated!
Add a constructor with two arguments (Resources and Bitmap) to your class and call the super constructor:
BitmapDrawable(context.getResources(), canvasBitmap);
this should fix your problem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With