Android :: Hide Soft Keyboard On Activity Without Any Keyboard Operations
Oct 13, 2010
I have a tabbed view with one Activity per tab, and when I switch from the first tab, which has a TextView, to the second tab, which only shows a clickable list, the soft keyboard is still there. I want it to go away.
I tried this:
CODE:.............
But this does not work, because there is no relevant view to provide, as there is no View on the screen that takes keyboard input.
View 1 Replies
Oct 4, 2010
I need to be able to hide the soft keyboard in response to clicking a button. I have seen numerous posts on this subject and it seems that the solution is to use the InputMethodManager, but I have been unable to get it to work for me.
View 1 Replies
View Related
Aug 5, 2010
I am struggling with the done button on the soft keyboard. I can't get the soft keyboard Done keypress to hide the keyboard. From another button, it works perfectly with imm.hideSoftInputFromWindow(editText.getApplicationWindowToken(), 0);
but the onKeyListener does not function the way I want. When I hit the editText, the soft keyboard shows up and its content is cleared from characters. The main.xml:
<EditText android:id="@+id/answer"
android:layout_gravity="center_horizontal" android:textSize="36px"
android:inputType="phone" android:minWidth="60dp" android:maxWidth="60dp" />
The Java file:
private EditText editText;...
editText = (EditText)findViewById(R.id.answer);
editText.setOnClickListener(onKeyboard);
editText.setOnKeyListener(onSoftKeyboardDonePress); ...
// method not working: private View.OnKeyListener onSoftKeyboardDonePress=new View.OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getKeyCode() == KeyEvent.FLAG_EDITOR_ACTION) {
// code to hide the soft keyboard
imm = (InputMethodManager) getSystemService( Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editText.getApplicationWindowToken(), 0); }
return false; } };
private View.OnClickListener onKeyboard=new View.OnClickListener() {
public void onClick(View v) { editText.setText(""); } };
The working method using a button (in the same java file):
private View.OnClickListener onDone=new View.OnClickListener() {
public void onClick(View v) { ....
// code to hide the soft keyboard
imm = (InputMethodManager) getSystemService( Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editText.getApplicationWindowToken(), 0); } };
When I press key no "9" the keyboard hides.
View 2 Replies
View Related
Jul 10, 2009
I'm having an EditText and a Button in my layout. After writing inside the edit field and clicking on the Button, I want to hide the virtual keyboard. I guess there should be a simple, one- or two-liner to make this happen. Where can I find an example of it?
View 5 Replies
View Related
Nov 1, 2010
I have a pretty standard search edit widget on top / search results list widget on bottom activity in my app. Below the results list widget I also have my view for ads. When the soft keyboard is brought up in this activity, I'd like to hide the view the ads are in because they consume too much screen space. I tried making that view android:isScrollContainer="true" but that had no effect.
So the question is, how can I ensure that certain views will be hidden when the soft keyboard is brought up?
View 3 Replies
View Related
May 9, 2010
I'm developing on the Droid Incredible (and have tested on a 1.5 AVD Emulator as well), and one of the tabs in my tab widget consists of a listview and a row with an EditText and a Send button (for a chat feature). I am using the following to close the soft keyboard once I click Send, but it's not working. This is identical to code I've found elsewhere that people have upvoted as correct.
See anything I'm missing?
CODE:.......
I also tried changing the flag to 0. No luck. Anyone know what's up? Just realized I was originally using hideSoftInputFromInputMethod() instead of hideSoftInputFromWindow(). Changing it didn't make it work though...
View 1 Replies
View Related
Nov 2, 2010
For an EditText view i can use setInputType(InputType.NULL), but an web view doesn't have it. I tried the rest of the solutions posted on stackoverflow but none of them worked for a web view.
View 1 Replies
View Related
Jan 12, 2010
I am struggling trying to have the soft keyboard appear in a search screen and from the looks of numerous pleas on various forums, I am not the only one. I have tried many variants, culling from the byzantine attempts of those others.
InputMethodManager imm = (InputMethodManager) getSystemService
(Context.INPUT_METHOD_SERVICE); imm.showSoftInput (query, 0);
(for 0, substitute InputMethodManager.SHOW_FORCED or InputMethodManager.SHOW_IMPLICIT.)
The problem seems to be that showSoftInput doesn't work from onCreate. This is a very common need. Surely there is a reasonable solution to this problem, or is it botched here?
View 3 Replies
View Related
Nov 12, 2010
Everyone knows that to hide a keyboard you need to implement:
CODE:............
But the big deal here is how to hide the keyboard when the user touches or selects any other place that is not an EditBox or the softKeyboard?
I tryied to use the onTouchEvent on my parent Activity but that only works if user touches outside any other view and there is no scrollview.
I tryed to implement a touch, click, focus listener without any success.
I even tryed to implement my own scrollview to intercept touch events but i can only get the coordinates of the event and not the view clicked.
Is there a standard way to do this? in iPhone it was really easy.
View 5 Replies
View Related
Jun 16, 2009
My activity contains an editable text view and I would like to automatically show the soft keyboard when the activity start. Anyone knows how to do it?
I tried this:
CODE:.....................
View 2 Replies
View Related
Aug 13, 2010
I have an activity which loads a TableLayout. This is made up of TextView and EditView fields. When I run my app within the emulator the layout appears correctly (WITHOUT the soft keyboard appearing). When I run the app from a device (HTC Evo) and enter the activity the soft keyboard ALWAYS appears. I tried doing an OnFocusChange() for the first field in the layout and then doing:
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(tvIndications.getWindowToken(), 0);
It doesn't work. The soft keyboard always appears.
View 4 Replies
View Related
Mar 17, 2010
I have 2 activities, A and B. When A starts, it checks for a condition and if true, it calls startActivityForResult() to start B. B only takes text input so it makes sense for the soft keyboard to automatically pop up when B start. When the activity starts, the EditText already has focus and it ready for input. The problem is that the keyboard never shows up, even with windowSoftInputMode="stateAlwaysVisible" set in the manifest under the <activity> tag for B. I also tried with the value set to stateVisible. Since it doesn't show up automatically, I have to tap the EditText to make it show.
View 2 Replies
View Related
Apr 26, 2010
I have added android:windowSoftInputMode="stateAlwaysVisible" to my Activity in AndroidManifest.xml and here's my layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<EditText android:id="@+id/EditText01" android:layout_width="wrap_content"
android:layout_height="wrap_content"></EditText>
<EditText android:id="@+id/EditText02" android:layout_width="wrap_content"
android:layout_height="wrap_content"></EditText>
<Button android:id="@+id/Button01" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Send"></Button>
</LinearLayout>
When the Activity starts, the EditText is focused, but soft keyboard isn't displayed. If I click on the EditText, then I see the soft keyboard. Do I need to set aditional parameters to display soft keyboard when my Activity starts?
View 4 Replies
View Related
Jun 14, 2010
In an Android app, whenever the activity launches, the textbox gets the focus and the soft keyboard pops up automatically. I have tried to stop this by using following line in onCreate method, but it does not work.
((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(EditText.getWindowToken(), 0);
View 4 Replies
View Related
Jul 31, 2010
I want to open soft keyboard while starting an activity. The activity contains nothing as its element. I just need to open soft keyboard on the launch. I've tried with
<activity android:windowSoftInputMode="stateAlwaysVisible|stateVisible|adjustResize" but it didn't work.
Also tried with
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
but it didn't work as well i'm using emulator to run the code
View 1 Replies
View Related
Nov 6, 2010
My activity's layout is as shown below.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<FrameLayout android:id="@+id/title_bar"
android:layout_width="fill_parent"
android:layout_height="25dip"
android:background="@drawable/bg_title" />..............
So, the search box is fixed to the bottom of the screen. But, when user clicks the EditText, Soft Keyboard shows up and pushes the layout out of the screen except the search box. I'm just starting out with Android, so am I doing anything wrong here??
View 1 Replies
View Related
Aug 13, 2010
I would like to play around with some ideas and develop a soft keyboard for Android to replace the default one.
Is there any general information about soft keyboard development for Android out there?
Any best practices or guidelines?
Can I do with my keyboard application pretty much anything I could do with a normal Android application?
Can I do HTTP connections to synchronize keyboard data with a cloud DB and other phones I have?
Can I open other windows/screens from a key press, e.g. to display a custom input interface different to a normal QWERTY one. If that doesn't work, can I use a pop-up dialog instead?
View 3 Replies
View Related
Jun 22, 2012
I'm using an MK802 mini PC. I don't have a USB keyboard yet.
When I plug in a wired USB mouse, I can use that to click on the on screen soft keyboard.
But when I plug in the wireless dongle for a USB mouse, the Android soft keyboard doesn't show anymore (I guess this is because the wireless dongle supports both keyboard and mouse, and tells Android a hardware keyboard is available, so Android doesn't show the soft keyboard).
Any way to ignore this and always show the soft keyboard? Or another keyboard I can download which will always show?
View 1 Replies
View Related
Aug 4, 2010
I have a layout which has one large EditText view at the top + a bunch of buttons at the bottom. The EditText is made to shrink and expand when the ime is activated/deactivated by using adjust_resize. The buttons at the bottom are pushed up above the ime.
I would like to hide these buttons when the ime displays, to provide enough space for the EditText view.
I have so far tried the following:
subclassed EditText and provided the activity the option to register a callback on the view's OnSizeChanged.
Used this callback to change the visibility of the buttons (actually the layout container) to GONE.
This work OK and does hide the buttons when the ime pops up. However, the EditText does not expand into the new available space. Furthermore, when the ime is disposed off, the EditText field is now bigger than it was originally, pushing (the now showing) buttons outside the screen.
I should also add that when typing the first letter into the view, and the ime displays the word options, the screen is redrawn and the EditText fills the vacant space. how to get this to work? Or even better, is there a simpler solution to my requirement? In my view, scrolling is not a good option.
View 2 Replies
View Related
Jun 24, 2010
CODE:............
I have this at the top of my application. When the application starts, the EditText is orange highlighted and has a cursor in it; when the EditText is tapped, the soft keyboard pops up. The user uses it to type into the EditText.
However, when they click the Button, my onClick method fires and does everything it's supposed to, however the soft keyboard stays on screen and the EditText is still highlighted with its cursor.
I also have, at the top of the Button onclick: findViewById(R.id.name).clearFocus();
In spite of this, the EditText does not seem to clear its focus. How do I make the button actually act as if it is submitting the form?
Also, I do not transition to a different Activity on the click of the Button. I suppose that is the typical case, and probably the reason why they don't bother hiding the keyboard. However I want to keep the search box and button at the top of the screen, so I just dynamically fill and add views to the screen when the Button is pressed. How can I achieve my desired behavior?
View 1 Replies
View Related
Nov 10, 2010
I tried it and it works so far.
Dev = ne0fhyk from XDA.
From the XDA forum: Link to app page = [APP][ROOT/Keyboard] Keyboard Manager - Dual keyboard: Portrait/landscape switch - xda-developers
Verbage:
Keyboard Manager allows you to customize what keyboard (input method) appear on input based on your phone orientation.
It displays the keyboards you have enabled on your android device, and let you select one per orientation (landscape/portrait).
As your phone switch orientation, the app automatically switch the keyboard.
Requirements:
- Rooted android device (app was tested on Samsung captivate 2.1)
- Root Explorer app, or similar app that allows you to edit the permissions of a file.
To install:
1- Download the app (KeyboardManager.apk) on your device sdcard.
2- Using Root Explorer, move the apk file to /system/app
3- Using Root Explorer, edit the file permissions like below:
-- User: 'Read/Write' checked
--Group: 'Read' checked
--Others: 'Read' checked
4- Exit Root Explorer
The app should be visible in your launcher as 'Keyboard Manager'
Update:
- Added option to disable notification icon
-' start on boot' feature is disabled because it's not yet complete and tested... Sorry for the confusion
Bugs:
-On certain applications (i.e: Messaging on Samsung Captivate), the input window occasionally freeze on orientation switch. Exiting the app, and resuming should fix it.
The app is still in development.
View 11 Replies
View Related
Nov 12, 2010
I have an EditText control that does not pop up the soft keyboard when the user touches it. The thing is, that I have a number of other EditText controls elsewhere in my application that all work fine, and I cannot see anything really different about this one.The code is a bit complex to post here, but I was wondering if anyone knows of any reasons why the soft keyboard would not appear in some cases.
View 3 Replies
View Related
Mar 29, 2010
I am interesting in integrating an arabic keyboard to the android system. I proceeded as follows: I have modified the xml and the layout in the package softkeyboard by replacing English letters and their codes by the arabic one.Of cource I created 2 new directories in softkeyboard: xml-ar and layout-ar After rebuilding the system , I don't find the new softkeyboard.
View 4 Replies
View Related
Apr 28, 2009
Using the 1.5 SDK. I have an application with a TabActivity and when I change from one tab with edit fields to another that does not need any user input I would like the virtual keyboard to be hidden. I've tried setting android:windowSoftInputMode="stateAlwaysHidden" on the manifest for the activity that doesn't need user input but it didn't work (maybe because the activity is triggered by a TabActivity).
I've found the method hideSoftInputMethod(IBinder, int) in the InputMethodManager class but I don't know how to get the IBinder object that this method needs.
How do I get that IBinder object? Are there other ways to hide the soft keyboard?
It would be even better if I could make the soft keyboard automatically hide when an EditText loses focus.
View 18 Replies
View Related
Jan 3, 2010
I don't want to show the virtual keyboard. I tried the below method but it doesn't make any difference.
View 2 Replies
View Related
Jun 24, 2010
I have One AutocompleTextView and I want to make the virtual keyboard disappear when he hits "DONE" at the AutocompleTextView. So far, the buttons "NEXT"/"DONE" do nothing at all Unfortunately I found no resources addressing this problem.
View 1 Replies
View Related
Jun 28, 2010
I've got a problem with my application in that the soft-keyboard is not being closed unless the user pushes the "back" button.I use several layouts which I load using the setContentView method of the application. Some layouts contain multiple EditText fields. The soft-keyboard pops up correctly when the entry boxes are being clicked, but never gets dismissed, even after I switch to a new layout using setContentView (instigated by on-screen push buttons).I found a way of apparently removing the keyboard using the "InputManager" class but how exactly does that work if I don't know which entry field opened/currently owns the keyboard?Is there a way of possibly invalidating a whole layout which would perhaps cause all resources (and hopefully the keyboard) to be cleared? As said before, I currently just use setContentView to load the next screen.
View 4 Replies
View Related
Jan 25, 2010
How can I select what soft-keyboard an edittext will load?
View 3 Replies
View Related
Jun 24, 2010
if application has EditText widget and user clicks on it, a qwertysoft keyboard appears. how do you get a numeric, 12key, or phone soft keyboard to appear instead. (I have searched documentation but I cannot find solution.)
View 2 Replies
View Related
Oct 20, 2009
How can I set numeric-only soft keyboard option for a text field? When I set the input-type to "number" it brings a soft keyboard which is actually a alpha-numeric one but already switched to numeric mode. What I want is a pure numeric soft keyboard with big numbers (no alphabets at all). I've already seen this in other applications and but don't know how to do it.
View 6 Replies
View Related