width and height of ICONE in MSGBOX2

petr4ppc

Well-Known Member
Licensed User
Longtime User
Dear friends, please help

I have this code:
Code: Copy
If File.Exists(File.DirInternal,"picture.jpg")=True Then
Dim myimage As Bitmap 
myimage = LoadBitmapSample(File.DirInternal, "picture.jpg", 15%x*scale, 15%y*scale)
End If
Msgbox2(mainmessage,"message", "OK","","", myimage)

Please, I cant set correct WIDTH and HEIGHT of IMAGE
Scale=1
When I set the most optimal = 15%x*scale and 15%y*scale
then is picture too small
When I set 16% then is too big....

Are my steps for SET dimension of image OK?
Thank you
p4ppc
 
YES YES YES


Erel thank you very much.
It is absolutely amazing.


Here are steps:
1)
I add Reflection library 2.4
http://www.b4x.com/forum/additional...pdates/6767-reflection-library.html#post39256

2)
And I use this Erel's code
Code: Copy
Sub Activity_Create(FirstTime As Boolean)
    Dim b As Bitmap
    b = LoadBitmap(File.DirAssets, "small_logo.png")
    b = CreateScaledBitmap(b, 16, 16, True)
End Sub

Sub CreateScaledBitmap(Original As Bitmap, Width As Int, Height As Int, Filter As Boolean) As Bitmap
    Dim r As Reflector
    Dim b As Bitmap
    b = r.RunStaticMethod("android.graphics.Bitmap", "createScaledBitmap", _
        Array As Object(Original, Width, Height, Filter), _
        Array As String("android.graphics.Bitmap", "java.lang.int", "java.lang.int", "java.lang.boolean"))
    Return b
End Sub

3]
It is quick and 100 percent functional

Thank you Erel!!
 
Upvote 0
Back
Top