Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting nextFocus for EditTexts not working

I have a problem with the nextFocus... attributes of EditText. First, I have a really hard time understanding which one of the nextFocus... parameters I'm supposed to use. When i press Next on my softkeyboard its looking for a next EditText, but how am i supposed to know if its looking down or up or wherever? I still have to specify the ID of the next View its going to focus, so why bother with directions at all?

Anyway, this is my layout: http://imgur.com/na1xn2s

And when I edit Stacks I want the next EditText to be the Rest, but it doesn't work. This is my code:

stacks = (EditText) dialogView.findViewById(R.id.calc_stacks_edit);
rest = (EditText) dialogView.findViewById(R.id.calc_rest_edit);
stacks.setImeOptions(EditorInfo.IME_ACTION_NEXT);
stacks.setNextFocusDownId(R.id.calc_rest_edit);
rest.setImeOptions(EditorInfo.IME_ACTION_DONE);

It still goes to the Amount EditText insead of Rest when Next button is pressed. What is the problem?

like image 711
JamMaster Avatar asked Aug 19 '14 19:08

JamMaster


1 Answers

From XML set these attribs to stack.

  android:nextFocusForward="@+id/rest"
    android:inputType="textNoSuggestions"
    android:imeOptions="actionNext"
like image 113
csenga Avatar answered Nov 12 '22 02:11

csenga