I found this code for B4A. It displays a jpeg image in memory onto the screen.
It works!
Now I need to do the same thing for iOS. (That's the whole point about B4X, correct?)
So everything moves over except:
1) Gravity.FILL is not defined for iOS.
2) Apparently, there is no "Activity" for iOS.
What is used to "AddView", then?
In other words, the BitMap bmp is created OK, so how do I display it
on the iOS screen?
Do I use a Panel?
And then use something like
Page1.RootPanel.AddView(View as Object, Left, Top, Width, Height)
If so, then imgtest (as ImageView) is the wrong type of "View" and does not work!!??
OK, now I see:
LoadBitmap works in b4a not in b4i
https://www.b4x.com/android/forum/threads/loadbitmap-works-in-b4a-not-in-b4i.49194/
Here you create an ImageView with the designer. I will try this and get back.
Andrew Gray
It works!
B4X:
Dim jpeg() As Byte = camEx.PreviewImageToJpeg(Prev, 70)
Log("Cam1_Preview ms: " & (l - lastPrev) & " Size : " & Prev.Length & " " & jpeg.Length)
Dim ins As InputStream
Dim bmp As Bitmap
Dim imgtest As ImageView
ins.InitializeFromBytesArray(jpeg, 0, jpeg.Length)
bmp.Initialize2(ins)
imgtest.Initialize("")
imgtest.Gravity = Gravity.FILL
Activity.AddView(imgtest, 10dip, 10dip, 100dip, 100dip)
imgtest.Bitmap = bmp
imgtest.BringToFront
Now I need to do the same thing for iOS. (That's the whole point about B4X, correct?)
So everything moves over except:
1) Gravity.FILL is not defined for iOS.
2) Apparently, there is no "Activity" for iOS.
What is used to "AddView", then?
In other words, the BitMap bmp is created OK, so how do I display it
on the iOS screen?
Do I use a Panel?
And then use something like
Page1.RootPanel.AddView(View as Object, Left, Top, Width, Height)
If so, then imgtest (as ImageView) is the wrong type of "View" and does not work!!??
OK, now I see:
LoadBitmap works in b4a not in b4i
https://www.b4x.com/android/forum/threads/loadbitmap-works-in-b4a-not-in-b4i.49194/
Here you create an ImageView with the designer. I will try this and get back.
Andrew Gray
Last edited: