I have an image res/drawable/test.png (R.drawable.test).
I want to pass this image to a function which accepts Drawable, e.g. mButton.set
If you are trying to get the drawable from the view where the image is set as,
ivshowing.setBackgroundResource(R.drawable.one);
then the drawable will return only null value with the following code...
Drawable drawable = (Drawable) ivshowing.getDrawable();
So, it's better to set the image with the following code, if you wanna retrieve the drawable from a particular view.
ivshowing.setImageResource(R.drawable.one);
only then the drawable will we converted exactly.