How to get EditText, IME Action, textMultiLine, to work in JellyBean

I ran into a pretty puzzle and could not find a solution. Obviously, JellyBean is changing the way IME actions are handled. I found many websites offering a solution that really works, but only for single-line EditTexts . Example: stack overflow.

My EditText widgets worked fine before JellyBean. This will correctly wrap words until the user presses the Finish key (return). Then he caught the event using OnEditorActionListener and processed accordingly. I tried several options for changing the settings with the following XML attributes: [/ p>

  • singleLined
  • scrollHorizontally
  • inputType
  • imeOptions
  • the lines

I could only get word wrapping without triggering the onEditorAction event or without word wrapping when the onEditorAction event was fired. How can I get a wrapping word and control a softkey enter key at the same time for JellyBean?

Update 1: Including the requested code. Please note that this works now, which works on all platforms except JellyBean. As I said earlier, I tried several different XML settings to no avail.

Update 2: Managed to hold Asus Transformer with JellyBean 4.1.1. Works great. So maybe this is a device error? My other JellyBean device is the Nexus 7, which runs on 4.1.2. Can anyone confirm this with other devices?

the code:

 private class OnMyEditorActionListener implements OnEditorActionListener { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_GO) { doSomething(); return true; } return false; } } 
 <EditText android:id="@+id/editbox_box_et" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@null" android:gravity="top|center_horizontal" android:imeOptions="actionGo" android:inputType="textMultiLine|textNoSuggestions" android:padding="@dimen/spacing_half" android:textSize="24sp" > </EditText> 
+6
source share
5 answers

After much testing, I decided that this is a bug specific to Nexus 7, and I cannot use the code that I can do to get around it. Interestingly, if I download another keyboard from Google Play, then the code really works!

+1
source

Enter the identifier yourself to the submit / go button

In action :

 private class OnMyEditorActionListener implements OnEditorActionListener { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == R.id.your_new_ID || actionId == EditorInfo.IME_Null) { doSomething(); return true; } return false; } } 

In xml :

 <EditText android:id="@+id/editbox_box_et" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@null" android:gravity="top|center_horizontal" android:inputType="textMultiLine|textNoSuggestions" android:padding="@dimen/spacing_half" android:textSize="24sp" android:imeActionId="@+id/your_new_ID" android:imeActionLabel="Go"> </EditText> 
+6
source

try the following:

 android:inputType="text" android:imeOptions="actionNone" 

as well as check out different options for wrapping words in the imeOptions xml file

+2
source

Try adding the android:imeActionId with an integer value (2 for actionGo). http://developer.android.com/reference/android/widget/TextView.html#attr_android:imeOptions

0
source

I had a problem triggering an event for Jelly Bean 4.1.2. Adding an input type helped me.

 android:imeOptions="actionGo" android:inputType="text" 
0
source

All Articles