Android :: Hide Soft Keyboard On Android After Clicking Outside EditText

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.

Android :: hide soft keyboard on android after clicking outside EditText


Android :: Android - EditText And Button - When Click Button - Unfocus EditText And Hide Soft Keyboard

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

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 View Related

Android : Way To Hide Soft Keyboard?

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

Android :: Hide Soft Keyboard On Done Keypress?

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

Android :: Close/hide The Soft Keyboard

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

Android :: Hide Views When The Soft Keyboard Is Up?

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

Android :: Hide Soft Keyboard Not Working

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

Android :: How To Hide Soft Keyboard In WebView ?

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

Android :: Way To Hide Keyboard After Typing In EditText In Droid?

Feb 26, 2010

When i enter text in it and press button to save data. keyboard does not disappear. can any one guide me how to disappear keyboard?

View 2 Replies View Related

Android :: Multiple EditText Not Getting Focus - No Soft Keyboard?

Sep 2, 2009

The home screen of my Android application has three EditText views, meant to be used as three different search functions, each with a "Search" button. The app works perfectly on the device (G1) when using the trackball: I can move between the EditTexts with the trackball, all the events fire as expected, I can enter text using the physical keyboard in the selected EditText, Enter correctly submits the proper search, etc.

However, I can't switch between the EditText views using touches - only by using the trackball. Touches seem to be completely ignored by the EditText. Touches do fire for the buttons, but very hard - takes a lot of tries to make a touch register. In the simulator, clicking on any EditText does nothing - the first one always remains selected, and I never get a soft keyboard. This is all inside a TabHost - I've read there are some problems with that configuration, but it sounds like a slightly different issue (the EditText doesn't seem to lose focus - everything works perfectly with the trackball).

View 2 Replies View Related

Android :: Soft Keyboard Covers Edittext Field

Jul 21, 2010

Is there a way to make the screen scroll to allow the text field to be scene?

View 3 Replies View Related

Android :: Trigger The Soft Keyboard For EditText In Dialogs

Nov 18, 2009

I am rendering an EditText as one element of a list-style AlertDialog (which is backed by the default ListView implementation). I sort of expected that this circumstance would not change the behavior of EditText, but it does: a click on the EditText does not spawn the soft keyboard anymore.

After an hour of messing around with focus settings and click handlers I got fed up and debugged into InputMethodManager.showSoftInput(), and found this:

CODE:....................

The problem here is that mServedView is the ListView that's backing the dialog, while view is the EditText, and ListView.checkInputConnectionProxy() does simply return false in the default implementation of ListView (to be overridden by subclasses).

Worse, I couldn't find a way to set a custom ListView which allows proxying IME reuqests; AlertDialog.Builder.setView() accepts a custom ListView, but this is not the ListView that InputMethodManager sees.

View 2 Replies View Related

Android :: Disable Soft Keyboard For EditText Control In Sdk1.1

Oct 14, 2009

I'm using sdk1.1, there is no setInputType in InputMethodManager.

View 3 Replies View Related

Android :: Show Soft Keyboard Automatically When Focus On EditText

Mar 8, 2010

I'm showing an input box using AlertDialog. The EditText inside the dialog itself is automatically focused when I call AlertDialog.show(), but the soft keyboard is not automatically shown. How do I make the soft keyboard automatically show when the dialog is shown? (and there is no physical/hardware keyboard). Similar to how when I press the Search button to invoke the global search, the soft keyboard is automatically shown.

View 2 Replies View Related

Android :: Soft Keyboard Key Fails In EditText On Gallery Widget

Jun 4, 2010

I am developing an application in Eclipse build ID 20090920-1017 using android SDK 2.2 and testing on a Google Nexus One. For the purposes of the tests below I am using the IME "Android keyboard" on a non-rooted phone.I have an EditText widget which exhibits some very strange behavior. I can type text, and then press the "del" key to delete that text; but after I enter a 'space' character, the "del" key will no longer remove characters before that space character.An example speaks a thousand words, so consider the following two incredibly simple applications.Example 1: An EditText in a LinearLayout widget:
package com.example.linear.edit;
import android.app.Activity;
import android.os.Bundle;
import android.view.ViewGroup.LayoutParams;
import android.widget.EditText;
import android.widget.Gallery;
import android.widget.LinearLayout;
public class LinearEdit extends Activity
@Override
public void onCreate(Bundle savedInstanceState)
{super.onCreate(savedInstanceState);
LinearLayout layout = new LinearLayout(getApplicationContext());
layout.setLayoutParams(new Gallery.LayoutParams(Gallery.LayoutParams.MATCH_PARENT, Gallery.LayoutParams.MATCH_PARENT));
EditText edit = new EditText(getApplicationContext());
layout.addView(edit, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
setContentView(layout);
}Run the above application, enter text "edit example", then press the "del" key several times until the entire sentence is deleted. Everything Works fine.Now consider example 2: An EditText in a Gallery widget:
package com.example.gallery.edit;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Gallery;
import android.widget.LinearLayout;
public class GalleryEdit extends Activity
{ private final String[] galleryData = {"string1", "string2", "string3"};
@Override
public void onCreate(Bundle savedInstanceState)
{super.onCreate(savedInstanceState);
Gallery gallery = new Gallery(getApplicationContext());
gallery.setAdapter(new ArrayAdapter(getApplicationContext(), android.R.layout.simple_list_item_1, galleryData)
@Override
public View getView(int position, View convertView, ViewGroup parent)
{LinearLayout layout = new LinearLayout(getApplicationContext());
layout.setLayoutParams(new Gallery.LayoutParams(Gallery.LayoutParams.MATCH_PARENT, Gallery.LayoutParams.MATCH_PARENT));
EditText edit = new EditText(getApplicationContext());
layout.addView(edit, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); return layout; setContentView(gallery);
}Run the above application, enter text "edit example", then press the "del" key several times. If you are getting the same problem as me then you will find that you can't deleted past the 'space' character. All is not well.If anyone could shed some light on this issue I would be most appreciative.

View 2 Replies View Related

Android :: Want To Get EditText Data / When User Clicks On Soft Keyboard Enter Key

Oct 15, 2010

I want to get EditText data when user clicks on the soft keyboard Enter key.

View 3 Replies View Related

Android :: Configure An EditText's Soft Keyboard To Use Numbers Initially - But Still Allow Text

Jul 21, 2010

I want to let users input a postal code to my app. The common use case is the US zip code, which are composed solely of numbers, so I'd like to display the numeric keyboard initially in the soft input. However, not all postal codes are solely digits, so I still need users to be able to enter other characters.

I've been trying to do this with android:inputType, but by setting the "number" flag, it automatically blocks any input except for number-based stuff. Is there a way to just accept general text, but get the soft keyboard to initially display a more number-based keyboard?

View 1 Replies View Related

Android :: Catch Event That Soft Keyboard Shown / Hidden For EditText?

Sep 25, 2010

Is it possible to catch the event that Soft Keyboard was shown or hidden for EditText?

View 2 Replies View Related

Android :: Block Virtual Keyboard While Clicking On Edittext In Android

Dec 4, 2009

How to block virtual keyboard while clicking on edittext in android?

View 1 Replies View Related

Android :: Use "+" From Soft Keyboard To Increase Value In An EditText?

Jul 20, 2010

I have an application in which I'm using an EditText to enter numbers. Howwever, I need to inlucde another option where the user can use the "+" and "-" to increase/decrease the value entered in the EditText. Is that possible?

View 3 Replies View Related

Android : How To Hide Soft Input Like Using BACK Buton?

Jul 11, 2009

In my app I have AutoCompleteTextView and "search" button. When user clicks "enter" or "search" an Intent is fired and new Activity is started. But in that "new" Activity SoftInput should be invisible, so I make ((InputMethodManager)getSystemService (INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(this.getCurrentFocus ().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); But when user clicks BACK and returns to activity with form he is unable to show soft input back by touching AutoCompleteTextView. He mus use trackball to select "search" button and than touch ACTextView. Bud when he is in "form" activity first time, shows soft input by touching AutoCompleteTextView and presses BACK button he is able to show soft Input by touching field. How can I hide soft input "correctly" (so it can be shwed back in intuitive way?) or hide it like BACK button does?

View 4 Replies View Related

Android :: How To Develop A Soft Keyboard - HTTP Connections To Synchronize Keyboard Data With A Cloud DB And Other Phones

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

Android :: Place An Animated Image Inside An EditText That We Can Show And Hide?

Sep 14, 2010

I am trying to add an animated spinner inside a EditText view to the right. And programmatically show/hide it.

I have created the animated spinner by introducing a linear interpolation rotation. code...

View 2 Replies View Related

Any Apps / Exposed Modules That Hide Soft Keys

Feb 22, 2014

I would like to know of any apps/exposed modules that hide the softkeys completely, like not fade out and dissapear but slide down to where you swipe up from bottoms of screen and they show up again. Any such apps?

View 1 Replies View Related

General :: MK802 Mini PC - Disable Soft Keyboard Hiding With USB Keyboard Available?

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

Android :: Android Soft Keyboard - Manipulate Views On Keyboard On - Off

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

Android :: Make The Keyboard To Show? Without Need Of Clicking Inside Edit Text

May 26, 2010

I read few threads, I'm sorry but none of them works/answers the simple scenario of:

1. I popup a dialog.

2. The dialog have EditText on it.

3. I want the keyboard to show up (without the need of clicking inside the edit text).

I tried:

CODE:.............

Then I tried both: CODE:.............


And: CODE:.............

View 4 Replies View Related

Android :: Why Might Soft Keyboard Not Pop Up?

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

Android : How Can I Get Soft Keyboard?

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







Copyrights 2005-15 www.BigResource.com, All rights reserved