Hi
when i use of BitmapToString(bitmap1) and StringToBitmap(base) into imageview it work corctly
but when insert it string to mysql field and read it have an error on command img.Initialize2(in)
java.lang.RuntimeException: Error loading bitmap.
java.lang.RuntimeException: Error loading bitmap at line img.Initialize2(in) : java.lang.RuntimeException: Error loading bitmap.
The pic2.txt file is the content of the image text field
when i use of BitmapToString(bitmap1) and StringToBitmap(base) into imageview it work corctly
but when insert it string to mysql field and read it have an error on command img.Initialize2(in)
java.lang.RuntimeException: Error loading bitmap.
B4X:
Sub JobDone (job As HttpJob)
If job.Success=True Then
ProgressDialogHide
Select job.JobName
Case "write"
MsgboxAsync(job.GetString,"Come")
Case "read"
Log("read")
Dim res As String
res=job.GetString
Log("Response from server: " & res)
If res<>0 Then
Dim parser As JSONParser
parser.Initialize(res)
Dim ListOfpersons As List
ListOfpersons = parser.NextArray
If ListOfpersons.Size=0 Then
Log("not found id : "&id)
Else
Dim person As Map
Dim txtpic As String
person = ListOfpersons.Get(0)
txtname.Text = person.Get("name")
txtpic = person.Get("pic")
ImageView3.Bitmap=StringToBitmap(txtpic)
End If
End If
End Select
Else
ToastMessageShow("Error During Connecting",False)
End If
End Sub
B4X:
Private Sub Breadsql_Click
Dim data As String
data="&id="&id
ht.Initialize("read",Me)
ht.PostString("http://" & ServerIP & "/p/readimage.php",data)
ProgressDialogShow("Please Wait ...")
End Sub
B4X:
Private Sub StringToBitmap(s As String) As B4XBitmap
Dim in As InputStream
Dim su As StringUtils
Dim b() As Byte = su.DecodeBase64(s)
in.InitializeFromBytesArray(b, 0, b.Length)
#if B4J
Dim img As Image
#else
Dim img As Bitmap
#end if
img.Initialize2(in)
Return img
End Sub
java.lang.RuntimeException: Error loading bitmap at line img.Initialize2(in) : java.lang.RuntimeException: Error loading bitmap.
The pic2.txt file is the content of the image text field