As the title implies the inDither
field in BitmapFactory.Options
is now deprecated. Android doc says "This field was deprecated in API level 24. As of N, this is ignored." Does anyone know why it has been deprecated and is there a alternative for this?
What is deprecation ? In Android deprecation usually means “ We will continue to support this, but we think there are better solutions ”. Most of the time features are deprecated rather than immediately removed, to provide backward compatibility, and to give programmers time to bring affected code into compliance with the new standard.
Most of the time features are deprecated rather than immediately removed, to provide backward compatibility, and to give programmers time to bring affected code into compliance with the new standard.
By researching why a method is deprecated I often learn interesting things about SDK and different ways of doing same thing. There is often a good reason behind deprecation which leads to better understanding of the Android SDK. So from a learning/growing perspective, it is also a worthwhile effort.
The main disadvantage is that the API might not be available in future versions, which will increase the cost of updating your application. If the deprecated method is easy to replace, use the replacement. If it isn’t, it’s up to you to decide whether developing the “future-proof” way is worth the additional effort.
seems it is too late to answer...
if you use canvas.drawBitmap, you may try:
Paint().apply {
isDither = false
isFilterBitmap = false
isAntiAlias = false
}
and for ImageView, setLayerPaint seems not suitable, you may create a BitmapDrawable like:
BitmapDrawable(resources, bitmap).apply {
setAntiAlias(false)
isFilterBitmap = false
}
Android: Disabling anti-aliasing for pixel art (blog)
Disable anti-aliasing on Android Imageview (StackOverflow question)
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