Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't change soft keyboard enter to "done" button after upgrading to gingerbread

very simply: inputField.setImeOptions(EditorInfo.IME_ACTION_DONE); used to make my soft keyboard show the "done" key instead of carraige return.

Since I updated my phone (Samsung Galaxy S) to gingerbread this line of code is having no effect.

Any ideas?

like image 811
jason Avatar asked Dec 09 '22 01:12

jason


2 Answers

I have seen this problem also and I believe it occurs when you have not set an inputType. Actually all imeOptions properties (along with a few others) get ignored completely if the inputType is set to EditorInfo.TYPE_NULL (the default).

So give one of these a shot (I picked next but you can put any type in):

XML:

    android:inputType="text"
    android:imeOptions="actionNext"

JAVA

    text.setInputType(EditorInfo.TYPE_CLASS_TEXT);
    text.setImeOptions(EditorInfo.IME_ACTION_NEXT);

And if you really want to go nuts you can use setImeActionLabel('Add', SOME_ID) and completely configure the action key (there are xml equivalentes also).

That being said. I could be completely wrong about your individual device but I figured this is easy to test and seems to always solve my problem so I should share.

like image 194
SciSpear Avatar answered Jan 20 '23 21:01

SciSpear


I have been researching the same problem. The IME (input method editor) on your device is it at fault and will not display the done button in the soft keyboard or the next button for that matter. HTC sense has its own soft keyboard and does not recognize ime directives. there are others and your samsung obviously is one. this is the first time I have ran head long into android fragmentation.

I did try setting it in XML, inflating, and creating a helper class, and a heap of other things. I was relieved to find out that it simply does not work.

So now instead of the keyboard editor completing the entry we must add a done button. I'm adding it to the end of my edit text using a relative layout to align them. Ill leave the IME code for those that have that functionality.... this is the is the only quick solution, the other being writing a entire custom soft keyboard for your app.

like image 35
Kickaha Avatar answered Jan 20 '23 21:01

Kickaha