0

I am new to android development. I use android:imeOptions = "actionDone|flagNoExtractUi" in EditText and I change that "Done" text to "Login" on soft keyboard. How i perform some action when click on Login Button of soft keyboard?

Spring Breaker
  • 8,233
  • 3
  • 36
  • 60

3 Answers3

0

For example you created method,

public void OnClickButton(View v)
{
/*
.
.
.
*/
}

Now in your layout.xml file in your button tag add

android:onclick="OnClickButton"

and here you go...

Ramya Selvarani
  • 499
  • 1
  • 9
  • 23
0

Find an answer to your question on this link:

Asha response

But remember what says CommonsWare in the best answer!

Community
  • 1
  • 1
phemt.latd
  • 1,775
  • 21
  • 33
0

TRY THIS CODE ...

ed.setSingleLine(true);
        ed.setHint("search places");
        ed.setTextSize(16);
        ed.setImeActionLabel("NAME YOU WANT TO GIVE FOR DISPLAY", EditorInfo.IME_FLAG_NAVIGATE_NEXT);
        ed.setImeOptions(EditorInfo.IME_FLAG_NO_FULLSCREEN);
        ed.setOnEditorActionListener(new EditText.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView v, int actionId,
                    KeyEvent event) {

                 if (event != null && event.getAction() != KeyEvent.ACTION_DOWN) {
                        return false;
                    } 
                 else if (actionId == EditorInfo.IME_ACTION_SEARCH
                        || actionId == EditorInfo.IME_ACTION_DONE|| event == null
                        || event.getAction() == KeyEvent.ACTION_DOWN
                        && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {

                    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
                    imm.hideSoftInputFromWindow(
                            ed.getWindowToken(), 0);





                    //DO YOUR WORK HERE .....




                    return true;
                }
                return false;
            }
        });