JackKirk Well-Known Member Licensed User Longtime User Jan 9, 2017 #1 Is there any way to prevent the soft keyboard from closing when the back key is pressed? Alternatively, is there any way to set up an event to trap when the soft keyboard is closed via the back key being pressed? I can't seem to find anything on the forums that directly address this - which is puzzling because I would have thought it would be a common requirement. EDIT: I should add that I have tried monitoring activity height via the IME library without success - all the relevant EditText views are inside a class. Thanks in advance... Last edited: Jan 10, 2017
Is there any way to prevent the soft keyboard from closing when the back key is pressed? Alternatively, is there any way to set up an event to trap when the soft keyboard is closed via the back key being pressed? I can't seem to find anything on the forums that directly address this - which is puzzling because I would have thought it would be a common requirement. EDIT: I should add that I have tried monitoring activity height via the IME library without success - all the relevant EditText views are inside a class. Thanks in advance...
Erel B4X founder Staff member Licensed User Longtime User Jan 10, 2017 #2 The IME solution should work. It doesn't matter whether the views are inside a class or not. You need to handle the HeightChanged and show the keyboard again (with CallSubDelayed or CallSubPlus). Upvote 0
The IME solution should work. It doesn't matter whether the views are inside a class or not. You need to handle the HeightChanged and show the keyboard again (with CallSubDelayed or CallSubPlus).
JackKirk Well-Known Member Licensed User Longtime User Jan 10, 2017 #3 OK, I had another crack at the IME approach and got it working. 2 problems: (1) You have to declare and use the IME library from the activity (this was my snag - obvious in retrospect) - ie trap the change in height via IME_HeightChanged event in activity - then notify the class instance via a dedicated method in the class which then can take appropriate actions in the class. This is all very messy, convoluted and decidedly unclassy (if you pardon the very poor pun) - and you have to set it up for every activity in the application. (2) It does not serve the purpose of setting up an event to trap when the soft keyboard is closed via the back key being pressed when the keyboard is floating (see image) because there is no height change of the view. So another question: is there any way to prevent the keyboard from floating - ie suppress the floating option in the keyboard? Thanks again... Upvote 0
OK, I had another crack at the IME approach and got it working. 2 problems: (1) You have to declare and use the IME library from the activity (this was my snag - obvious in retrospect) - ie trap the change in height via IME_HeightChanged event in activity - then notify the class instance via a dedicated method in the class which then can take appropriate actions in the class. This is all very messy, convoluted and decidedly unclassy (if you pardon the very poor pun) - and you have to set it up for every activity in the application. (2) It does not serve the purpose of setting up an event to trap when the soft keyboard is closed via the back key being pressed when the keyboard is floating (see image) because there is no height change of the view. So another question: is there any way to prevent the keyboard from floating - ie suppress the floating option in the keyboard? Thanks again...
Erel B4X founder Staff member Licensed User Longtime User Jan 10, 2017 #4 JackKirk said: suppress the floating option in the keyboard? Click to expand... No. It is a feature of your keyboard app. Most keyboards do not have this feature. Upvote 0
JackKirk said: suppress the floating option in the keyboard? Click to expand... No. It is a feature of your keyboard app. Most keyboards do not have this feature.
JackKirk Well-Known Member Licensed User Longtime User Jan 10, 2017 #5 I'm using a Samsung S5 which as far as I am aware is stock standard. Under [Settings/Language and input] It appears to have a "Samsung keyboard" with no obvious options to change it. This would have to make it up in the category of "most keyboards" surely. EDIT: just installed the Google keyboard from the play store - this one doesn't have a floating option - of course can't rely on my apps users to oblige by ensuring they have a non-floating keyboard - so my app is left with a small but findable wormhole thru which a user could crawl. Last edited: Jan 14, 2017 Upvote 0
I'm using a Samsung S5 which as far as I am aware is stock standard. Under [Settings/Language and input] It appears to have a "Samsung keyboard" with no obvious options to change it. This would have to make it up in the category of "most keyboards" surely. EDIT: just installed the Google keyboard from the play store - this one doesn't have a floating option - of course can't rely on my apps users to oblige by ensuring they have a non-floating keyboard - so my app is left with a small but findable wormhole thru which a user could crawl.