2

I'm currently making a soft keyboard of my own in android and having a hard time getting the ime action selected - (IME_ACTION_SEARCH or IME_ACTION_DONE etc.).

For instance, if an user enters google search than the action button should be a search button and if it's a sms then it'll be a line break. How can I differ between them?

I've tried looking for it in the with no luck.

onCreateInputView(){} 

Any help is appreciated.

1 Answer 1

4
+100

You can call getCurrentInputEditorInfo on your InputMethodService. Then you can inspect the EditorInfo's imeOptions property.

int imeOptions = mInputMethodService.getCurrentInputEditorInfo().imeOptions; switch (imeOptions&EditorInfo.IME_MASK_ACTION) { case EditorInfo.IME_ACTION_NONE: // None case EditorInfo.IME_ACTION_GO: // Go case EditorInfo.IME_ACTION_SEARCH: // Serach case EditorInfo.IME_ACTION_SEND: // Send case EditorInfo.IME_ACTION_NEXT: // Next case EditorInfo.IME_ACTION_DONE: // Done } 
Sign up to request clarification or add additional context in comments.

1 Comment

I am having same problem.but getCurrentInputEditorInfo(). throwing null ?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.