Android EditText, soft keyboard show/hide event?

I'd used following workaround: As far as my content view is a subclass of LinearLayout (could be any other view or view group), I'd overridden onMeasure method lilke following: Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final int proposedheight = MeasureSpec. GetSize(heightMeasureSpec); final int actualHeight = getHeight(); if (actualHeight > proposedheight){ // Keyboard is shown } else { // Keyboard is hidden } super. OnMeasure(widthMeasureSpec, heightMeasureSpec); } This workaround helped me to hide some controls when keyboard is showing and bring back otherwise Hope this would be useful.

I'd used following workaround: As far as my content view is a subclass of LinearLayout (could be any other view or view group), I'd overridden onMeasure method lilke following: Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final int proposedheight = MeasureSpec. GetSize(heightMeasureSpec); final int actualHeight = getHeight(); if (actualHeight > proposedheight){ // Keyboard is shown } else { // Keyboard is hidden } super. OnMeasure(widthMeasureSpec, heightMeasureSpec); } This workaround helped me to hide some controls when keyboard is showing and bring back otherwise.

Hope this would be useful.

There actually isn't such an event to catch. The IME is simply showing and hiding its window; the feedback you get from this is the window manager causing your own window's content to resize if you have put it in resize mode.

– DiveInto Mar 25 at 5:09 @DiveInto you can check it in my workaround – woodshy Jun 12 at 20:11.

We can toggle the on-screen keyboard using the code below. InputMethodManager inputMgr = (InputMethodManager)getSystemService(Context. INPUT_METHOD_SERVICE); inputMgr.

ToggleSoftInput(0, 0); To show Soft Keyboard for EditText: EditText editText = (EditText) findViewById(R.id. MyEdit); InputMethodManager mgr = (InputMethodManager) getSystemService(Context. INPUT_METHOD_SERVICE); // only will trigger it if no physical keyboard is open mgr.

ShowSoftInput(editText, InputMethodManager. SHOW_IMPLICIT); And to hide: InputMethodManager mgr = (InputMethodManager) getSystemService(Context. INPUT_METHOD_SERVICE); mgr.

DeSoftInputFromWindow(editText.getWindowToken(), 0); Refer this links: http://www.androidpeople.com/android-hide-virtual-keyboard-through-code/ , http://stackoverflow.com/questions/1109022/how-to-close-hide-the-android-soft-keyboard.

2 Thanks, but I'm not asking how to control the keyboard to be shown or hidden. I just want to catch the event when the system shows the keyboard. – shkim Sep 25 '10 at 17:05 1 @Skone I had just given the answer with the tag "We can toggle the on-screen keyboard".

– Paresh Mayani Jul 20 at 5:05 what's the harm if he's giving some extra info? It's helped me! – Sagar Hatekar Aug 29 at 19:50 -1 because I keep reading your post and thinking i'm on the wrong page!

– dsjbirch Oct 5 at 19:59 @dsjbirch sorry for my this answer, but FYI, please check my above comment for Shkim – Paresh Mayani Oct 10 at 4:58.

Try these methods: showSoftInput(View, int, ResultReceiver) and hideSoftInputFromWindow(IBinder, int, ResultReceiver). You can override onReceiveResult(int resultCode, Bundle resultData) method of ResultReceiver class to handle show/hide event.

EditText editText = (EditText) findViewById(R.id. InputMethodManager mgr = (InputMethodManager) getSystemService(Context. InputMethodManager mgr = (InputMethodManager) getSystemService(Context.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions