Sliding physical keyboard causes my app to start over ?!

myriaddev

Active Member
Licensed User
Longtime User
I showed my app to customer today, and she slightly opened
the physical keyboard, causing my app to start over ?! No
activity_KeyPress during/before start over. Happens also with full
sliding of physical keyboard out and also when sliding it in.
I am using Samsung M900, rooted to 2.2.2, using v1.80.
My code is "private", but tomorrow I can cut it down and publish
it. Help!
 

stevel05

Expert
Licensed User
Longtime User
Looking at the android developers guide, this is the 'normal' Android behavior, it allows loading/unloading of resources needed to access the keyboard, even though you may not want to use it.
 
Last edited:
Upvote 0

myriaddev

Active Member
Licensed User
Longtime User
Right ON SteveLo5!

I understand what is going on now, but many of the routines
I have yet to find in B4A to "handle Configuration of Keyboard"...
Point me in the right direction. Thanks, Jerry
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Hi Jerry,

From what I read yesterday, I don't think there is anything that needs to or can be done to configure it's behavior. You can certainly find out if a physical keyboard exists. The place to look is on the Android Developers site or just Google. If you can find anything on there that you feel will help, then it's a case of finding out how to implement it within B4A, which is where these forums can help.

Steve
 
Upvote 0

enonod

Well-Known Member
Licensed User
Longtime User
stevel05 wrote
Looking at the android developers guide, this is the 'normal' Android behavior, it allows loading/unloading of resources needed to access the keyboard, even though you may not want to use it.

The guide refers to 'oncreate(), 'activity onDestroy(), onSaveInstallState() etc.
Can you please direct me to the translation to B4A routines to achieve the same, I have failed to find.
 
Upvote 0

enonod

Well-Known Member
Licensed User
Longtime User
My thanks.
I have found that with so many places to look, I often overlook!
 
Upvote 0

myriaddev

Active Member
Licensed User
Longtime User
"Handling the Configuration Change Yourself"

Thank you all for your help. I will include
... android:configChanges="keyboardHidden"... in my manafest file.
Then look for:
***
public void onConfigurationChanged (Configuration newConfig)

Since: API Level 1
Called by the system when the device configuration changes while your activity is running. Note that this will only be called if you have selected configurations you would like to handle with the configChanges attribute in your manifest. If any configuration change occurs that is not selected to be reported by that attribute, then instead of reporting it the system will stop and restart the activity (to have it launched with the new configuration).
At the time that this function has been called, your Resources object will have been updated to return resource values matching the new configuration.
Parameters

newConfig The new device configuration.

***
Then capture the change in physical keyboard with:
"If newConfig.keyboardHidden = Configuration.keyboardHidden Then "eat msg if not need at this time(state)"
***
Where can I find "onConfigurationChanged" in B4A ?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Basic4android doesn't expose this event. This event usually causes more harm than good.
It will not solve your issue. You will still need to remake the layout.

If you don't want to handle orientation changes then you can lock your activity to a specific orientation or if you do want to handle orientation changes then you can create a matching layout variant and use StateManager to handle the state.
Basic4android Search: StateManager
 
Upvote 0

myriaddev

Active Member
Licensed User
Longtime User
Thank you Erel

Hi Erel, very nice system! My problem is not with screen orientation
(portrait only) but when the physical keyboard slides out or is pushed out,
it causes my program to start over. I have saved everything so starting
over is ok except it takes time to connect to B4AServer and c2dm and
my server and many other things (again). I would like to "capture" changes
in "keyboardHidden" msgs and do something smart with that event.

I noticed that ad libraries capture this event and do something smart.
Please point me in a direction. I will not bug you again on this matter.
Keep up the Great work!!
Jerry
 
Upvote 0
Top