Android Question Foldable Screen Size Change

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I just got a Z Fold 7 and when my App moves from front screen to inside screen there is a Height changed but I do not seem to be able to realize that the screen width changed.
Is there any way to know when the current screen size when a foldable moves from small to larger or larger to small


PS: Just realized that I might not need this (would be nice) because a double arrow (resizing arrow) appears at the bottom of my screen and clicking it causes a resize of my app. But surely would be nice to auto resize without user having to click
 
Last edited:

wes58

Active Member
Licensed User
Longtime User
Maybe it is the same problem I had a couple years ago. Have a look there - https://www.b4x.com/android/forum/threads/solved-galaxy-z-flip-5-issue.149499/#post-948325
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Didn't work for me.
But I did find this line in my Manifest

resizeableActivity:
SetApplicationAttribute(android:resizeableActivity, "false")

Not sure why I had it. But changed the false to true and now my app moves from Cover Screen to inside the open fold and resizes and back to the cover screen when closed. Just what I wanted.

NOTE: I also added screenLayout to my configChanges
screenLayout:
SetActivityAttribute(Main, android:configChanges, "orientation|keyboard|keyboardHidden|screenSize|uiMode|screenLayout")
This is suppose to resize the activity without restarting??
B4X:
By default, Android restarts an activity (destroying and recreating it) when configuration changes occur, such as a change in orientation, screen size, or language settings.
To prevent this for foldable devices and window resizing, add the following attribute to your activity tag in AndroidManifest.xml: android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation".
This tells the system that your app will handle these configuration changes directly, rather than relying on activity recreation.

Not sure if any of this helps you as well.
 
Last edited:
Upvote 0

wes58

Active Member
Licensed User
Longtime User
I am glad that it is working for you.
I fixed my issue as I described in post #9 on the thread I posted before. There is probably a difference between Z flip and Z fold how they behave.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…