Following function crashes with java.lang.reflect.InvocationTargetException / Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.Bitmap.setHasAlpha(boolean)' on a null object reference
B4X:
Sub CreateScaledBitmap(Original As Bitmap, Width As Int, Height As Int, keepRatio As Boolean, filter As Boolean) As Bitmap
Dim jo As JavaObject
Dim newHeight As Int
newHeight = Height
If keepRatio Then
Dim CalcRatio As Int
CalcRatio = Original.Width / Original.Height
newHeight = Width / CalcRatio
End If
jo.InitializeStatic("android.graphics.Bitmap")
Log(Original)
Return jo.RunMethod("createScaledBitmap", Array (Original, Width, newHeight, filter))
End Sub
FYI, the bitmap passed in the function is valid, the log shows "(Bitmap): 1080 x 1920"...
According to the documentation it is possible since API 1. I was refering to the "setHasALpha" which exists since API 12. But possibly it is being used internally so it existed.
Even if you need API10, I would recompile for a higher API to see if THIS is the problem.
Also, do you mean you want to rescale in API 10 or that the app should be compatible with API 10? If so, just try with minSDKversion to 10, but targetSDK to a higher one.