Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Objective
After upgrading the Android SDK to 23, the getdrawable and GetColor method hints are obsolete.
Solution Solutions
Getresources (). GetColor replaced with Contextcompat.getcolor
Getresources (). Getdrawable replaced with contextcompat.getdrawable
Examples are as follows:
int colorint = getresources (). GetColor (r.color.coloraccent); //Returns a value of type int of color: -49023 int colorInt2 = Contextcompat.getcolor (this, r.color.coloraccent); //Returns a value of type int of color: -49023 = getresources (). getdrawable= contextcompat.getdrawable (this, r.mipmap.ic_launcher);
Resources
Getdrawable,getcolor Obsolete Alternative methods
http://blog.csdn.net/u011368551/article/details/50886884
Obsolete alternatives to getdrawable and GetColor in Android