Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Android
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Android
how to hide the keyboard in android when click the edit text in dialog box
Sarra Sakka
Ranch Hand
Posts: 283
posted 9 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
How can i hide the keyboard in android when click outside of the edit text in dialog box?
thank you in advance
Ulf Dittmer
Rancher
Posts: 43081
77
posted 9 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Play around with
View focus = getCurrentFocus(); if (focus != null) { im.hideSoftInputFromWindow(focus.getWindowToken(), 0); }
Sarra Sakka
Ranch Hand
Posts: 283
posted 9 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
the definition of im is as the followings ?
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
Sarra Sakka
Ranch Hand
Posts: 283
posted 9 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I do this in my code and the keyboard still display after i click outside my edit text
final Dialog settingdialog = new Dialog(MainActivity.this); settingdialog.setContentView(R.layout.setting_dialog); settingdialog.setTitle(theMessagesList.getMessage(MessageDefine.STR_SETTINGS)); settingdialog.getWindow().setGravity(Gravity.TOP); // to hide a keyboard when a setting menu display settingdialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); //Dialog no disappear when click outside settingdialog.setCanceledOnTouchOutside(false); final InputMethodManager im = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); settingdialog.show(); //hide a keyboard on click outside dialog View focus = getCurrentFocus(); if (focus != null) { im.hideSoftInputFromWindow(focus.getWindowToken(), 0); }
Ulf Dittmer
Rancher
Posts: 43081
77
posted 9 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
When is this code executed? Is "focus" non-null?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Javascript - alert dialog box and text box
hide default keyboard on click in android
Close Dialog Box(Urgent!)
Keyboard's 'Enter' key Event??
Hide Error Dialog Boxes(VERY URGENT)
More...