I'm currently working with Bitmap and trying to make some operation on pixels. I wanted to use Color.argb()
and Color.valueOf()
but those doesn't work for API Level < 26.
Is there any library or something similar that could work with any API Level > 21 ?
Here is the part of the function I use :
int width = myBitmap.getWidth();
int height = myBitmap.getHeight();
Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
int [] allpixels = new int [ bmp.getHeight()*bmp.getWidth()];
myBitmap.getPixels(allpixels, 0, bmp.getWidth(), 0, 0, bmp.getWidth(),bmp.getHeight());
bmp.setPixels(allpixels, 0, width, 0, 0, width, height);
for(int i =0; i<bmp.getHeight()*bmp.getWidth();i++) {
allpixels[i] = Color.argb(
Color.valueOf(allpixels[i]).red(),
Color.valueOf(allpixels[i]).red(),
Color.valueOf(allpixels[i]).green(),
Color.valueOf(allpixels[i]).blue());
}
Google has changed the Target API-level requirements for an Android app from August 2018. From August 2018, new apps must target at least Android 8.0 (API level 26). From November 2018, app updates must target Android 8.0 (API level 26).
a high API Level allows developers to take advantages of the latest APIs and capabilities provided by new platforms. in order to use the latest SupportLibrary, compileSdkVersion has to match the SupportLibrary version too. For example, in order to use SupportLibrary-28.x.x, compileSdkVersion has to be set to 28 as well.
In Android, it’s true that th e re is a 1:1 relationship between the SDK and the API and often these two terms are used as synonymous, but it’s important to understand they are not the same thing. But it’s correct to say that for each Android version there is an SDK and there is an equivalent API and API Level.
Usually, updates to the framework API are designed so that the new API remains compatible with earlier versions of the API, for this reason, most of the changes to the new API are additive and the old parts of API are deprecated but not removed. But now someone could argue…
Use the version of argb()
that takes int
instead of float
. That has been around since API Level 1.
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