B4J Question Bitmap.initialize2 for B4XBitmap?

schimanski

Well-Known Member
Licensed User
Longtime User
I'm using the following sub to decrypt a saved bitmap in b4a and b4i. Now i want to use this sub in b4j with b4xbitmap, to use it in the xcustomlistview. B4Xbitmap doesn't have a method to read an inputstream. Is there an other solution?

B4X:
#If B4I
     Dim Cipher As Cipher
#Else
     Dim Cipher As B4XCipher
#End If

Sub deccryptBitmap(DirSource As String, FileSource As String, PW As String) As Bitmap
    Try   
        Dim data() As Byte = Cipher.Decrypt(Bit.InputStreamToBytes(File.OpenInput(DirSource, FileSource)), PW)
        Dim in As InputStream
        in.InitializeFromBytesArray(data, 0, data.Length)
        Dim BM As Bitmap
        BM.Initialize2(in)
    
        Return BM
    Catch
        Return Konferenz.crypt_icon
    End Try
End Sub
 
Top