I am trying to add and remove edittext through RecyclerView Adapter and it's working fine but I also want to shift the focus to next empty edittext when I click on adapter item which fills the edit text. It would be grateful if someone could help ,I am newbie to android.
- Here is my focus next method:
private void focusNext() {
View view = getAdapterView(mAddDropPointAdapter.getCurrentFocusedPosition() + 1);
}
if (view != null) {
view.findViewById(R.id.fragment_google_autoc_et_destination).requestFocus();
} else if (getActivity() != null) {
KeyboardUtils.hideKeyboard(getActivity());
}
}
- Here is from where I am calling this method.
@Override
public void onAdapterItemClick(int position, @NonNull GoogleAutoCompleteAddressDto addressDto) {
/// Doing some stuff
focusNext();
}
After clicking the adapter item , focus stays at the same edittext it doesn't shift to next.