0

I have an 2 edit texts, one of them is visible and other is not. I have set visibility "gone" for the invisible one. Now when I click input method next from edittext one, I make edittext two visible and request focus there, it gets visible but focus is not there. Interesting thing is I made visibility "invisible" instead of "gone". here is the code...

 option1.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if(actionId == EditorInfo.IME_ACTION_NEXT){                   
                option2.setVisibility(View.VISIBLE);
                option2.requestFocus();                   
            }
            return false;
        }
    });
Aalap Patel
  • 2,058
  • 2
  • 17
  • 31
  • Think about this... You are `IME_ACTION_NEXT`-ing into one EditText, so the focus goes there. Why are you trying to force focus to a different EditText? – OneCricketeer Jul 31 '16 at 00:10
  • I think u didn't get my problem...After I finish typing in option one and press input next button it should make invisible edit text visible as well as take cursor there... – Aalap Patel Jul 31 '16 at 00:44
  • Sure. But I still don't understand. When you "tab" to the next input, focus should be placed there. Is that not happening? – OneCricketeer Jul 31 '16 at 01:40
  • no it is not going to next edittext...\ – Aalap Patel Aug 01 '16 at 14:48
  • Alright, then can you provide a [mcve] so we can try to reproduce the problem? – OneCricketeer Aug 01 '16 at 14:50
  • sir this is the code I am using nothing else than that which has been mentioned here in the question... in xml option 2's visibility is "gone"... – Aalap Patel Aug 01 '16 at 15:26
  • I understand that, I'm trying to help you. Please [edit] to show the XML and the parts of the Activity where you load these views – OneCricketeer Aug 01 '16 at 15:28

1 Answers1

1

I am not sure it will work or not. But your setOnEditorActionListener() is returning false, make it to return true.

Nainal
  • 1,728
  • 14
  • 27