There is a resyclerView consisting of editText inside the ViewHolder. To configure each item in the list - each editText uses a ViewModel, which is built on the Field entity - some information about the user. Field can be name, lastName, phone, email and so on. In the onBind adapter, we assign the viewModel to the ViewHolder, than we achieve a specific build of the list item - an icon, a field type, etc.

enter image description here

The task is to ensure the transition by pressing Enter to the next input field. For the fields about which we know everything is done simply

new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) { if (actionId == 45) { // request focus for next field } return true; } } 

Here, the situation is such that the Adapter has an idea only about the Fields array and somewhere inside the ViewHolder rebuilds based on them inside onBind, that is, this is the only place where we can add transition processing from field to field by Enter, but there we only have access to the current ViewHolder. ViewHolder and TextField (custom EditText from the picture) are even less aware of other ViewHolders and TextFields. How can I make a transition on Enter to the next field in this case?

  • Are you sure of the expediency of using RecyclerView in this case? How many EditText do you have? - post_zeew
  • @post_zeew this screen is used in two cases. In the first from 10 to 18 fields, here the second adds 4 fields and, accordingly, it turns out from 14 to 22 fields (spread, because email and phone can multiply to a certain limit, which also speaks in favor of recycler view) - iamthevoid
  • You can catch the Enter key in EditText and follow it to the next item in RecyclerView by calling scrollToPosition(int position) in its LayoutManager . - post_zeew

0