spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

AutoCompleteTextView: Remove soft keyboard on back press instead of suggestions


You can achieve that by override-ing
[onKeyPreIme][1], a simple custom view should work

    public class CustomAutoCompleteTextView
extends AutoCompleteTextView {

        public CustomAutoCompleteTextView(Context
context) {
            super(context);
        }

        public CustomAutoCompleteTextView(Context
context, AttributeSet attrs) {
            super(context, attrs);
        }

        public CustomAutoCompleteTextView(Context
context, AttributeSet attrs, int defStyleAttr) {
            super(context, attrs, defStyleAttr);
        }

        @Override
        public boolean onKeyPreIme(int keyCode,
KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_BACK
&& isPopupShowing()) {
                InputMethodManager inputManager =
(InputMethodManager)
getContext().getSystemService(Context.INPUT_METHOD_SERVICE);

               
if(inputManager.hideSoftInputFromWindow(findFocus().getWindowToken(),
                   
InputMethodManager.HIDE_NOT_ALWAYS)){    
                    return true;
               }
            }

            return super.onKeyPreIme(keyCode,
event);
        }

    }

  [1]:
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.4.4_r1/android/widget/AutoCompleteTextView.java#AutoCompleteTextView.onKeyPreIme%28int%2Candroid.view.KeyEvent%29

Categories : Android

Related to : AutoCompleteTextView: Remove soft keyboard on back press instead of suggestions
identifying keyboard shortcut (Ctrl + W) press in chrome
Try to check for click event on Window object and check if the keyCode is equal to keyCode of "W", then check if the CTRL key is clicked. This part of snippet has worked on FF and Chrome for me. $(window).keydown(function(e) { // check for W button if (e.which == 87) { // check if CTRL is clicked! if (e.ctrlKey) { alert('gg'); } } });

Categories : Javascript
The EVT_CLOSE gets fired every time I click on wx.Frame or press key on keyboard
I could fix it by making following change: if "win" in sys.platform: self.OnSplashScreenExit("") else: self.Bind(wx.EVT_CLOSE,self.OnSplashScreenExit)

Categories : Python
JQuery Autocomplete Reduce Suggestions
As per the documentation there is no parameter for this however, using the below CSS you can make the autocomplete box size fit your needs. .ui-autocomplete { height: 200px; overflow-y: scroll; overflow-x: hidden;} http://stackoverflow.com/a/7617449/3387421 JSFiddle: http://jsfiddle.net/whn1stde/ $(document).ready(function(){ $( "#test" ).autocomplete({ source: [ "test","test2","test3","

Categories : Jquery
Program won't print out the intersection or difference! Any suggestions?
I think i found your errors: You use set.length (or setA.length or ...) instead of the method parameter (size or sizeA or ...) multiple times. Especially in your sort method this is problematic: the sorted arrays will start with 0s. You don't recognize this, since you ignore 0s in your print method. Print it the way you print the intersection and difference and you'll see the error. You pass in

Categories : Java
LibGDX loading scene2D widgets very slow for first time, need suggestions
To summarize the comments... The OP had a convenience class for texture references, that listed the textures like this: public class Gui { public static final Texture BOX = new Texture("box.png"); public static final Texture SELECTION_HIGHLIGHT= new Texture("selectionHighlight.png"); //... } Since they are declared static, they are members of the class, not an instance of a class

Categories : Java
Recently Add
I'm trying to create an onListItemClick even for a customized adapter. The array of items is found in res/values folder
No navigation/status bar touch listener exists, why?
z-index in Relative layout
java.lang.SecurityException: Permission Denial: getIntentSender() when using UiAutomation in a test
mvvmcross videoview URL binding
Android Emulator Unfortunately dev tools has stopped
Square Dagger error: class is exclusively members injected / cannot be scoped required
Installing a widget from an APP
How to stop onDraw() methods causing jerky scrolling of a ListView
How to find my Google Play Services Android BASE64_PUBLIC_KEY
Set style programatically does not work
How to get contacts from phonebook and sim but skype, facebook etc. in android
Where to put JUnit test in Android project
My Android Studio project keeps running my old project/application
how to avoid OUtOfMemory problems with create Bitmap
What tools use and how do continuous integration and test in Android with eclipse?
Converting drawable resource to Bitmap Android
Fragment Transaction show() does not show fragment on second time
Espresso - How to match ActionBar visibility?
Viewport setting ignored in Phonegap Android app, but only on certain phones?
how to open an activity with url scheme android
Android AsyncTask and Thread different behavior
How can one ellicit a Toast from a Service to a Fragment
GCMIntentService onRegistered not called
LinearLayout cropping but not expanding in Scrollview
Get a file from the application directory
How to set layout params using view's on touch listener?
How to disable Google Fit and revoke permissions from the app itself
Android Wear - receiving message from Wear without WearableListenerService?
How can I start new activity from another package?
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.