Android Question [Solved] B4XFloatTextField, crash on Android 4

mw71

Active Member
Licensed User
Longtime 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:
B4X:
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??
 

Attachments

  • ftp_zugang.bal
    8.1 KB · Views: 193
Last edited:

mw71

Active Member
Licensed User
Longtime User
o.k., change, but error remains
(Panel size is unknown.... solved)

B4X:
    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"),"",Null, False)
        
    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)
 
Upvote 0

mw71

Active Member
Licensed User
Longtime User
You will need to upload a small project that demonstrates it.
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


Why aren't you using B4XDialog? It has templates for lists.
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.

If you are creating an input dialog then check B4XPreferencesDialog.
i use it on other Place. For this its not the right.
 

Attachments

  • Test_FTP_Menue.zip
    10.6 KB · Views: 203
Last edited:
Upvote 0

mw71

Active Member
Licensed User
Longtime 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?
 
Upvote 0

mw71

Active Member
Licensed User
Longtime User
You shouldn't initialize the ScrollView inner panel. Remove that line and try again.

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);
 
Upvote 0
Top