Whenever I have to save the image associated with a checkbox through the imagem = minha_checkbox.getButtonDrawable();
method it always gives me an error called call requires API level 23 (current min is 17)
How can I resolve this?
Whenever I have to save the image associated with a checkbox through the imagem = minha_checkbox.getButtonDrawable();
method it always gives me an error called call requires API level 23 (current min is 17)
How can I resolve this?
The getButtonDrawable () method was only introduced in the CheckBox class (CompoundButton ) in version 23 of the API.
You have two solutions:
It uses the CompoundButtonCompat class and uses its static getButtonDrawable () :
imagem = CompoundButtonCompat.getButtonDrawable(minha_checkbox);
Note: You need the Android Support Library, revision 23.0.1 or higher.