Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What exactly is "id == EditorInfo.IME_NULL"?

Tags:

android

ime

I see id == EditorInfo.IME_NULL used regularly in places which are supposed to match "Done" or "Enter" in addition to another condition such as the enter key or an IME action but I cannot find any explanation as to what exactly it is.

like image 595
Monstieur Avatar asked Nov 25 '13 09:11

Monstieur


2 Answers

This code is preset everywhere when dealing with the "Enter" button on the soft keyboard.

The Andriod Documentation is not explicit, but IME_NULL is the generic key for "Enter"

This is also relevant in relation to IME's (Input Method Editor).

like image 57
angryITguy Avatar answered Nov 08 '22 07:11

angryITguy


It's wrong, but it's been copied and pasted quite a bit and is probably more prevalent than code that actually uses the correct constant here.

Per the documentation, IME_NULL is supposed to represent the value of the imeOptions field when no option flags are set.

The correct constant in this case is IME_ACTION_UNSPECIFIED, which indicates that the user has instructed your app to take some action, but the exact action is not defined.

The two are interchangeable because they have the same integer value (zero).

like image 33
j__m Avatar answered Nov 08 '22 07:11

j__m