Android Question Error Load Bitmap to ImageView

4rdn1_s

Member
Hi All, I have this code that I intended to display an Image to Imageview but I'm having this Error, please someone help me..
this is the Error and the code.
The Error:
"====================================================================

Error occurred on line: 134 (Daftar_Validasi)
java.lang.RuntimeException: Error loading bitmap.
    at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize2(CanvasWrapper.java:539)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
    at anywheresoftware.b4a.shell.DebugResumableSub$RemoteResumableSub.resume(DebugResumableSub.java:22)
    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:815)
    at android.os.Handler.dispatchMessage(Handler.java:104)
    at android.os.Looper.loop(Looper.java:218)
    at android.app.ActivityThread.main(ActivityThread.java:5657)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:990)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:785)

"======================================================

Error Load Image:
Dim RsObj As Object = Starter.mysql.ExecQueryAsync("Mysql","select *,date_format(tgl_lahir,'%d/%m/%Y') as tgllahir from t_dpt where no_nik = '" & EditText1.text & "'",Null)
Wait for (RsObj) Mysql_QueryComplete (Success1 As Boolean, Rs As JdbcResultSet)
If Success1 Then
Try
    Do While Rs.NextRow
        Label1.Text = "NIK : " & Rs.GetString("no_nik")
        Label2.Text = "Nama : " & Rs.GetString("nama")
        Label3.Text = "Tempat, Tgl. Lahir : " & Rs.GetString("kota_lahir") & ", " &  Rs.GetString("tgllahir")
        'Label4.Text = "Alamat Lengkap : "
        Label5.Text = Rs.GetString("alamat") & ", RT. " & Rs.GetString("no_rt") & " / RW. " & Rs.GetString("no_rw") & ", Kel. " & Rs.GetString("kelurahan") & ", Kec. " & Rs.GetString("kecamatan") & ", Kab. " & Rs.GetString("kota") & ", " & Rs.GetString("propinsi")
        Label6.Text = "No. TPS : " & Rs.Getstring("no_tps")
        'Label7.Text = "Tim Sukses : " & Rs.GetString("nm_ts")
        Spinner1.SelectedIndex  = Spinner1.IndexOf(Rs.GetString("nm_ts"))
        Check1.Checked = IIf(Rs.GetString("cek")="1",True,False)
        EditText2.Text = Rs.GetString("keterangan")
        EditText3.Text = Rs.GetString("aktif_partai")
        '-- Load The ID Image
        Buffer = Rs.GetBlob("foto_file")
        InputStream1.InitializeFromBytesArray(Buffer,0,Buffer.Length)
        Foto.Initialize2(InputStream1) '----- ERROR HAPPEN IN THIS LINE'
        'ImageView1.SetBackgroundImage(Foto)
        ImageView1.Bitmap=Foto
        'B4XImageView1.Bitmap=Foto
        '-----
    Loop
    EditText2.RequestFocus
Catch
    Success1 = False
    'Log(LastException)
End Try
Else
    Success1 = False
    Log(LastException)
End If
 
Top