Can't fint BitmapFactory

Morgan222

New Member
Licensed User
Longtime User
I an new to Basic4Android, but I love it. :sign0104:

I need some bitmap operation from it including loading from Byte array. I have seen examples and reference for BitmapFactory but the IDE does not recognize it. Is there some library or SDK option that I need to include it?
 
Last edited:

Morgan222

New Member
Licensed User
Longtime User
Thanks. I had already implemented it a different way by copying the byte array to a stream and then loading the bitmap from a stream using Initialize2().

B4X:
Sub Globals
   Dim imgCrt As ImageView
            :
            :
End Sub


'AStreams_NewData() Process message received on AsyncStream from socket
Sub AStreams_NewData (Buffer() As Byte)
   
   'Check for CRT image From record type in header (first byte of message)
   If Buffer(0) = ImageCrtRec Then
   
      'Message header in first 4 bytes of stream. 
      'Copy image data from input buffer starting at 5th byte
      Dim InputStream1 As InputStream
      InputStream1.InitializeFromBytesArray(Buffer, 4, Buffer.Length-4)

      'Read stream into image view
      Dim Bitmap1 As Bitmap
      Bitmap1.Initialize2(InputStream1)
      imgCrt.Bitmap = Bitmap1
   End If

End Sub

That is working pretty good.
I then looked into LoadBitmap(), but the reference I found for it only showed it using a file for input.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…