aLya121314
Member
Hi everyone.
I am hoping that there is someone who can help me with this error i encounter.
I created 2 Listview in one layout. If I press button1, listview1.visible = true and the listview2.visible = false. And if I press button2, listview2.visible = true and listview1.visible = false. The data that is being display in the listview are from the database. In Listview1, I got no problem loading the data. but when it comes to listview2, I encounter this error:
I send two sql request in each listview. to get the data in listview1 here is the code:
And for ListView2, here is the code:
This code are located in one activity module.
Thank you.
I am hoping that there is someone who can help me with this error i encounter.
I created 2 Listview in one layout. If I press button1, listview1.visible = true and the listview2.visible = false. And if I press button2, listview2.visible = true and listview1.visible = false. The data that is being display in the listview are from the database. In Listview1, I got no problem loading the data. but when it comes to listview2, I encounter this error:
B4X:
Error occurred on line: 119 (DBRequestManager)
java.lang.RuntimeException: Error loading bitmap.
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize2(CanvasWrapper.java:539)
at b4a.example.dbrequestmanager._bytestoimage(dbrequestmanager.java:227)
at b4a.example.homepage$ResumableSub_GetPrutas.resume(homepage.java:869)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
at anywheresoftware.b4a.shell.Shell.runGoodChain(Shell.java:475)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:293)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:267)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:137)
at anywheresoftware.b4a.BA$2.run(BA.java:387)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:264)
at android.app.ActivityThread.main(ActivityThread.java:7581)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)
I send two sql request in each listview. to get the data in listview1 here is the code:
B4X:
Sub GetGulay
Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("getGulay", Null)
Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
ProgressDialogShow("Loading...")
If j.Success Then
req.HandleJobAsync(j, "req")
Wait For (req) req_Result(res As DBResult)
'work with result
' req.PrintTable(res)
Log(res.Columns)
ListViewGulay.Clear
For Each row() As Object In res.Rows
Dim oBitMap As Bitmap
Dim buffer() As Byte
buffer = row(res.Columns.Get("image"))
oBitMap = req.BytesToImage(buffer)
ListView1.AddTwoLinesAndBitmap(row(0) , row(1) & " /kilo", oBitMap)
Next
Else
Log("ERROR: " & j.ErrorMessage)
End If
ProgressDialogHide
j.Release
End Sub
And for ListView2, here is the code:
B4X:
Sub GetPrutas
Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("getPrutas", Null)
Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
ProgressDialogShow("Loading...")
If j.Success Then
req.HandleJobAsync(j, "req")
Wait For (req) req_Result(res As DBResult)
'work with result
' req.PrintTable(res)
Log(res.Columns)
ListViewPrutas.Clear
For Each row() As Object In res.Rows
' Dim oBitMap As Bitmap
' Dim buffer() As Byte
Dim blob() As Byte
Dim img As Bitmap
blob = row(res.Columns.Get("image"))
img = req.BytesToImage(blob)
ListView2.AddTwoLinesAndBitmap(row(0), row(1) & " /kilo", img)
Next
Else
Log("ERROR: " & j.ErrorMessage)
End If
ProgressDialogHide
j.Release
End Sub
This code are located in one activity module.
Thank you.