Android Question [Solved] B4XFloatTextField, crash on Android 4

Discussion in 'Android Questions' started by mw71, Jul 28, 2019.

  1. mw71

    mw71 Active Member Licensed User

    Hi

    i use B4XFloatTextField for Password.
    - on New Device (Android 9), it works (Android 5/6 not testet)
    - on Android 4.4, Crash

    Code:
    Code:
    Dim SV_FTP As ScrollView
    SV_FTP.Initialize(
    800dip)
    SV_FTP.Panel.Initialize(
    "ftp_zugang_panel")
    SV_FTP.Panel.LoadLayout(
    "ftp_zugang")
    crash on SV_FTP.Panel.LoadLayout

    Panel size is unknown. Layout may not be loaded correctly. <<- on Boot, Android 4.4 and 9
    b4xfloattextfield_createbitmap (java line: 190)
    java.lang.IllegalArgumentException: width and height must be > 0
    at android.graphics.Bitmap.createBitmap(Bitmap.java:667)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:649)
    at anywheresoftware.b4a.objects.drawable.CanvasWrapper.Initialize(CanvasWrapper.java:81)
    at anywheresoftware.b4a.objects.B4XCanvas.Initialize(B4XCanvas.java:37)
    at de.udxsoft.udxlog.b4xfloattextfield._createbitmap(b4xfloattextfield.java:190)
    at de.udxsoft.udxlog.b4xfloattextfield._update(b4xfloattextfield.java:636)
    at de.udxsoft.udxlog.b4xfloattextfield._designercreateview(b4xfloattextfield.java:366)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
    at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:67)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
    at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
    at de.udxsoft.udxlog.main$ResumableSub_btn_Backup_SetFTP_Click.resume(main.java:8405)
    at de.udxsoft.udxlog.main._btn_backup_setftp_click(main.java:8365)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:180)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
    at android.view.View.performClick(View.java:4191)
    at android.view.View$PerformClick.run(View.java:17184)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4867)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
    at dalvik.system.NativeStart.main(Native Method)

    whats wrong? on other Place (other bal File) it works also on Android 4, i think its a Problem in the bal File or with the ScrollView??
     

    Attached Files:

    Last edited: Jul 28, 2019
  2. Erel

    Erel Administrator Staff Member Licensed User

    Panel size is unknown. Layout may not be loaded correctly

    Add the ScrollView to the activity or parent panel and only then load the layout.
     
  3. mw71

    mw71 Active Member Licensed User

    o.k., change, but error remains
    (Panel size is unknown.... solved)

    Code:
    Dim SV_FTP As ScrollView
        
        
    Dim CV As CustomLayoutDialog
        
    Dim sf As Object = CV.ShowAsync("FTP Zugang", _
                                        Starter.loc.Localize(
    "txt_Save"), _
                                        Starter.loc.Localize(
    "txt_Cancel"),"",NullFalse)
            
        
    Wait For (sf) Dialog_Ready (DialogPanel As Panel)

        SV_FTP.Initialize(
    800dip)
        SV_FTP.Panel.Initialize(
    "ftp_zugang_panel")

        DialogPanel.AddView(SV_FTP,
    0,0,100%x,100%y)

        SV_FTP.Panel.LoadLayout(
    "ftp_zugang")
    b4xfloattextfield_createbitmap (java line: 190)
    java.lang.IllegalArgumentException: width and height must be > 0
    at android.graphics.Bitmap.createBitmap(Bitmap.java:667)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:649)
    at anywheresoftware.b4a.objects.drawable.CanvasWrapper.Initialize(CanvasWrapper.java:81)
    at anywheresoftware.b4a.objects.B4XCanvas.Initialize(B4XCanvas.java:37)
    at de.udxsoft.udxlog.b4xfloattextfield._createbitmap(b4xfloattextfield.java:190)
    at de.udxsoft.udxlog.b4xfloattextfield._update(b4xfloattextfield.java:636)
    at de.udxsoft.udxlog.b4xfloattextfield._designercreateview(b4xfloattextfield.java:366)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
    at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:67)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
    at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
    at de.udxsoft.udxlog.main$ResumableSub_btn_Backup_SetFTP_Click.resume(main.java:8428)
    at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:250)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:190)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:180)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
    at anywheresoftware.b4a.agraham.dialogs.InputDialog$ExtendedBALayout$1.run(InputDialog.java:2467)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4867)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
    at dalvik.system.NativeStart.main(Native Method)
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    You will need to upload a small project that demonstrates it.

    Why aren't you using B4XDialog? It has templates for lists.

    If you are creating an input dialog then check B4XPreferencesDialog.
     
  5. mw71

    mw71 Active Member Licensed User

    o.k., it will take a time. be note, the Error gets only on Android 4.4 Device (on my Android 9 Device all o.k.)
    Edit -> TestFile add


    I have Create it long before B4X Dialogs start (and it works). Later i have change one Field to B4XFloatTextField, Test on newer Device, works.
    Now i see it crash on older Device.

    i use it on other Place. For this its not the right.
     

    Attached Files:

    Last edited: Jul 29, 2019
  6. mw71

    mw71 Active Member Licensed User

    "Update"
    Test on Android 5.1, works
    Test on other Android 4, Crash

    Test on Android 4:
    - Load a other Layout with B4XFloatTextField on CustomLayoutDialog (direct, no ScrollView), works
    - Test with B4X Dialogs, crash (at load to ScrollView)
    - Test with ScrollView2D, crash

    -> it only Crash on Android 4 when load on ScrollView

    Anyone an idea?
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    I still think that it will look much better if you use B4XPreferencesDialog.

    You shouldn't initialize the ScrollView inner panel. Remove that line and try again.
     
  8. mw71

    mw71 Active Member Licensed User

    remove Line, unfortunately the same error.

    b4xfloattextfield_createbitmap (java line: 171)
    java.lang.IllegalArgumentException: width and height must be > 0
    .......

    Line 168 to 171 from Java File:
    //BA.debugLineNum = 233;BA.debugLine="Dim c As B4XCanvas";
    _c = new anywheresoftware.b4a.objects.B4XCanvas();
    //BA.debugLineNum = 234;BA.debugLine="c.Initialize(p)";
    _c.Initialize(_p);
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    The crash happens because of a bug in XUI Views related to the empty hint text. It is fixed in v2.13.
     
  10. mw71

    mw71 Active Member Licensed User

    solved:), thank you!!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice