0

I have 5 edit texts where user enters his options, I keep first two visible and other 3 visibility gone. If user wants to enter option 3 I make it visible by pressing action next key on keyboard while user finishes typing on option 2. But the problem is it doesnt focus on edit text 3. Now to experiment visibility of edittext 3 from gone to invisible, action next method works well. Is there a way to make input next method work when view's visibility turns gone to visible?

I am using this code to make focus appear on edittext 3 which is not working in case of edittext visibility turning visible from gone. Same code works well in case of edittext visibility turning visible from invisible.

option2.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if(actionId == EditorInfo.IME_ACTION_NEXT){

                option3.setVisibility(View.VISIBLE);
                option3.requestFocus();

            }
            return false;
        }
    });
Aalap Patel
  • 2,058
  • 2
  • 17
  • 31

1 Answers1

0

How to make focus on button3 :

 button2.setOnEditorActionListener(new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                if (actionId == EditorInfo.IME_ACTION_NEXT) {
                  button3.setVisibility(View.VISIBLE);

                 button3.requestFocus();
                }
                return false;
            }
        });
ViramP
  • 1,659
  • 11
  • 11
  • thank you for the response please see updated question... if anyother ideas are there kindly chip in with... – Aalap Patel Jul 30 '16 at 14:32
  • No..I that's y I feel it is something to do with visibility type.. it work if visibility turn visible from invisible instead of visible from gone.. – Aalap Patel Jul 30 '16 at 14:44