Android Question I'm scaling challenged. Please help?

Widget

Well-Known Member
Licensed User
Longtime User
Are you sure about the layout files? I did use "export as zip". Is there a setting to turn on/off inclusion of layout files?

No, you can't exclude the layout files. It looks like you used an external zip utility and zipped up only the main directory of your B4A app. When posting files you should always use B4A's own File > Export as Zip > Include Shared Modules. The layout files should be included if you do this.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I don't understand the logic in your layouts.
You have a 320 * 480 variant but the widths of the views are bigger 360 and 340?
Then you have a second variant 480 * 960, what kind of device is this variant for?
What are your target devices, portrait and landscape or only portrait?
You should use the standard layout and use anchors and AutoScale.
Did you have a look at chapters 5 Screen sizes and resolutions, 8.8 The Abstract Designer, 8.11 Anchors and 8.12 AutoScale in the B4A Beginner's Guide?
 
Upvote 0

Scotter

Active Member
Licensed User
Hey. Thanks for the reply and pointing me to those resources.
What I am shooting for:
Portrait only.
I started with 320x480 but some vertical space was wasted on my test device, a 1440x2560 lg g4 with 5.5" screen.
I want it to fit on smaller devices, too.
I'm under a time crunch to publish something that works. Trying to decide if I should go back to 320x480 designer. Or push forward now to try to modify the app to scale.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Attached you find a modified project showing one possibility with Anchors and DesignerScripts.
Layouts must NOT be loaded in If FirstTime = True!
Which version of the CustomListView library do you use?
With the class module version 1.20 I got no error, I added the library version 1.50 and get errors.
The attached version uses the class module.
https://www.dropbox.com/s/r5b6dvq7z64yzhx/Nutshell-04.zip?dl=0
 
Upvote 0

Scotter

Active Member
Licensed User
THANK YOU!!!
I'm using latest clv. Your errors could be because you don't have latest password to get into the database.
 
Upvote 0

Scotter

Active Member
Licensed User
I'm going thru your project (the one you modified) and mine side by side to (a) copy your changes; and (b) learn from what you did.
Did you make any changes that I might not notice, like changes to the design files?
And again: THANK YOU!
 
Upvote 0

Scotter

Active Member
Licensed User
I made a new image winter-squirrels-341.jpg instead of winter-squirrels-340.jpg, removed the white part at the bottom.
The layoutpage01.bal and row.bal files are new ones.
Thanks!
Doh it turns out I was using clv 1.10
 
Upvote 0

Scotter

Active Member
Licensed User
Hey Klaus -
THANK YOU so much for your help!
Did you comment out stuff like "lblMsgBottom.TextSize=18"
because it messes up scaling? Or did I comment those out?
Sorry, I'd made a new version since I saw the one you modified and sent me.
Thanks!
 
Upvote 0

Scotter

Active Member
Licensed User
You should use the library, latest version: 1.50
New version (yours and mine merged): https://www.dropbox.com/s/xo7fh2il95rqilk/nutshell-w-scaling-04.zip?dl=0
Hey Klaus: I have removed the clv module, copied customlistview 1.50 files to my program files library, closed the B4A project and reopened. In "library" pane I checkboxed the customlistview 1.50 library and yet I get this error:

Class not found: OceanMedia.Nutshell02.customlistview, trying: OceanMedia.Nutshell02.customlistview
Error occurred on line: 135 (Main)
PLEASE NOTE LINE NUMBER 135 IS NOW: Activity.LoadLayout("LayoutPage01")

java.lang.RuntimeException: java.lang.ClassNotFoundException: OceanMedia.Nutshell02.customlistview
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:708)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:340)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at OceanMedia.Nutshell02.main.afterFirstLayout(main.java:102)
at OceanMedia.Nutshell02.main.access$000(main.java:17)
at OceanMedia.Nutshell02.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5525)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
Caused by: java.lang.ClassNotFoundException: OceanMedia.Nutshell02.customlistview
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at java.lang.Class.forName(Class.java:285)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:377)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:425)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:144)
... 17 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "OceanMedia.Nutshell02.customlistview" on path: DexPathList[[zip file "/mnt/asec/OceanMedia.Nutshell02-2/base.apk"],nativeLibraryDirectories=[/mnt/asec/OceanMedia.Nutshell02-2/lib/arm64, /vendor/lib64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
... 23 more
Suppressed: java.lang.ClassNotFoundException: OceanMedia.Nutshell02.customlistview
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 24 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…