Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not getting "Go" button on android keyboard

Im using android:imeOptions="actionGo" for a edit text box. Its working properly on Android default keyboard. I'm getting "GO" button . But if i try to change the input method to either swype or LG keyboard on my LG device , I'm not getting "Go" instead im getting enter symbol. Why this is happening . I want Go button regardless of wt keyboard im using. Please can any one help me in this ?

like image 789
Nemo Avatar asked Sep 12 '11 09:09

Nemo


2 Answers

Please add following two lines to your edittext:

<EditText
    android:singleLine="true"
    android:imeOptions="actionGo"/>

This will enable Go button on your softkeyboard

And to listen Go button Add

editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if(actionId== EditorInfo.IME_ACTION_GO){
                //perfrom your action
            }
            return false;
        }
    });
like image 179
Mahesh Avatar answered Oct 21 '22 01:10

Mahesh


Sadly not all manufacturer implements correctly their custom keyboard so you wont be able to have the "Go" button.

For instance, on HTC phones you won't get something else than a "enter button" even if you set a search action: android:imeOptions="actionSearch". On a Motorola Droid it works fine.

On some phones you have to set the imeOptions in java code to make it works. You can have a try on your LG.

like image 42
ol_v_er Avatar answered Oct 21 '22 01:10

ol_v_er