'getDrawable(int)' is deprecated as of API 22: Android 5.1 (Lollipop)

Tools : Android Studio 3.5.3 Target AVD : API29 'getDrawable(int)' is deprecated as of API 22: Android 5.1 (Lollipop)... Inspection info : Reports where deprecated code is used in the specified inspection scope. Resources res = getResources(); bitmap = (BitmapDrawable) res.getDrawable(R.drawable.img_0020); int bitmapWidth = bitmap.getIntrinsicWidth(); int bitmapHeight = bitmap.getIntrinsicHeight(); Correct as below bitmap = (BitmapDrawable) ContextCompat.getDrawable(this, R.drawable.img_0019); int bitmapWidth = bitmap.getIntrinsicWidth(); int bitmapHeight = bitmap.getIntrinsicHeight();

댓글

가장 많이 본 글