Android Question Keyboard problems on rotation

gadgetmonster

Active Member
Licensed User
Longtime User
Hi All

I have an app that has a large edittext field at the top of the screen and several objects underneath. Say you were using the app in portrait orientation and tap the edittext field. The keyboard shows and off you go. However, if you then rotate the device the activity re-loads. In this case, if the keyboard was open during rotation, the re-drawn activity is scrunched up at the top as if it tried to draw the whole activity in the space above the keyboard.

I have tried to close the keyboard in both activity_pause and activity_resume to no avail. Whilst the keyboard is not shown after rotation, the activity is still scrunched up in a very small space.

I have tried closing the keyboard using IME and phone. I have added DoEvents both before and after the hide command is called and I have tried using callsubdelayed all to no avail.

Any help would be greatly appreciated.

Many thanks
 
Hi Erel

To perform a simple test I added a Toast message to activity_create which displays activity.height. bearing in mind I am using a galaxy note 3, I made the following observations:

1. Start in portrait, no keyboard visible, turn to landscape: Activity height 1005 (correct)
2. Start in portrait, keyboard visible, turn to landscape: Activity height 119 (Incorrect)

My Activity_Create function creates several objects at runtime which all get added to a scrollview. The issue i'm seeing is directly related to the incorrect activity height being set as the scroll view position / height is calculated based on the activity height.
 
Upvote 0
Back
Top