Android :: Catch Event That Soft Keyboard Shown / Hidden For EditText?
Sep 25, 2010Is it possible to catch the event that Soft Keyboard was shown or hidden for EditText?
View 2 RepliesIs it possible to catch the event that Soft Keyboard was shown or hidden for EditText?
View 2 RepliesI have an application that renders content into a SurfaceView. When the longPress event is received the application requests that the soft keyboard be displayed so the user can interact with what is being displayed on the SurfaceView. The problem that I have is that the size of the SurfaceView is not changed when the soft keyboard is displayed. I have read the article titled: "Updating applications for on-screen input methods" and I've modified my application manifest so that the following is specified for the activity in question:
<activity android:name="AndroidSurfaceViewActivity" android:configChanges="orientation|keyboardHidden" android:windowSoftInputMode="adjustResize"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity>
So you can see that I've specified the "android:windowSoftInputMode" tag to be resize........................
I have a simple user interface: an EditText should be located below a SurfaceView. I use a RelativeLayout to arrange these two views. Now, when I tap on the EditText to open the virtual keyboard the SurfaceView slides up but the EditText is hidden and does not show the typed string. To reproduce, use the following layout XML code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout01"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<SurfaceView...............................
When the user presses editText, the soft keyboard pops up. I want to hide a view or 2 while it is on. How to do that?
View 1 Replies View RelatedHow to catch event from the virtual keyboard?In fact, I want to know if the screen is touch for instance.
View 4 Replies View RelatedI have a few elements in a RelativeView with the align bottom attribute set, when the soft keyboard comes up the elements are hidden by the soft keyboard. I would like them to move up so that if there is enough screen space they are shown above the keyboard, or to make the section above the keyboard scrollable so the user can still see the elements.
View 1 Replies View RelatedI have an Android application that is a TabHost with a WebView. I use it to load a specific html file that has a text field in its bottom part. When I touch the html textfield, the soft keyboard pops up, and hides the textfield, so that I cannot see what I have typed.
Here is the layout:
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >.......................
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).
Is there a way to make the screen scroll to allow the text field to be scene?
View 3 Replies View RelatedI 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.
I want to do something when the soft keyboard hide. Is there any function to detect that event?
View 3 Replies View RelatedI'm using sdk1.1, there is no setInputType in InputMethodManager.
View 3 Replies View RelatedI'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 RelatedI 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.
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?
I am designing an Android app and I'm having a couple of layout issues. I have a screen with 3 EditTexts on it in a row, and I would like for the 'next' key on the soft keyboard to cycle between the EditText fields. As for now, the 'next' key has no effect. Also, when the soft keyboard is displayed, it covers up the third of the EditTexts. Is there any way to push up the layout in the event that the soft keyboard is drawn?
View 1 Replies View RelatedI want to get EditText data when user clicks on the soft keyboard Enter key.
View 3 Replies View RelatedI 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?
How do I catch specific key events from the soft keyboard?
specifically I'm interested in the "Done" key.
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.
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 RelatedDoes anybody know how to catch the map zoom in/out event for Android 1.5?Before Android 1.5, I can use ZoomControls which has a setOnZoomInClickListener(). In order to get zoom controls, I can write like this:ZoomControls mZoom = (ZoomControls) mMapView. getZoom Controls(); But, since 1.5, the mMapView.getZoomControls() is deprecated. Instead of this, the documentation suggests using mMapView.setBuiltInZoomControls.Since 1.6, I can use ZoomButtonsController, which has a set OnZoomListener(). In order to get zoom button controls, I can write like this:ZoomButtonsController mZoom = (ZoomButtonsController) mMapView.getZoomButtonsController().setOnZoomListener(this);So, how can I get map zoom in/out event without using mMapView.getZoomControls() for Android 1.5 ?
View 3 Replies View RelatedI'm clearly a newb, and I was wondering if anyone knows how I can detect a "ring" event on my cellphone through the android sdk? Generally I want to do something with the phone when it begins ringing! Any thoughts? If you want to simply point me to a page in the api documents that would be a good answer for me, I just don't know how to start my research!
View 1 Replies View RelatedI am trying to find a way to listen to a built-in Camera application Capture event.I want my application to be triggered each time a picture is taken. Is it possible?
View 1 Replies View RelatedActually I'm trying to implement an ontouchlistener into my android (1.5) application. therefore i implemented the "ontouchlistener" into the class, and then i put my code into the: So isn't there a way to catch the touch event before it gets to each of those views?
View 1 Replies View RelatedI would like to write an application which shutdown (finish()) itself when the sleep button is pressed. Any hint?
View 3 Replies View RelatedI'm making a drawing app. In the centre of the screen, I want the app to contain the user's drawing. At the top of the screen I want buttons for different drawing tools. When a drawing tool is selected, I want buttons specific to that tool to appear at the bottom of the app (e.g. the brush tool might show a "increase brush size" button at the bottom of the screen), replacing what buttons might be there from before. What's a good way to do this?
At the moment, I'm using a relative layout for the whole GUI, then adding a separate linear layout for each tool panel at the bottom of the screen (i.e. the panels overlap when shown together). When a tool button is clicked, I hide all the settings panels except for the one related to the selected tool. This seems a bit messy but I'm not sure how else to do it. It would be nice if I could do it in a way that keeps the code modular for each tool.
If the BACK button is pressed when the soft keyboard is being displayed, no Back keycode event is generated (when it's not shown, and Back is pressed, then my View's onKeyDown()/onKeyUp() methods get called back).
Is this expected behaviour? I'm trying to catch when the IME is hidden upon BACK being pressed. I'm currently working around this in the endBatchEdit() method (I'm implementing BaseInputConnection).
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?
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.