0

how to display new EditText field below one current EditText when 1 character is inputed on first EditText

2 Answers 2

1

You can set that EditText below your current EditText and intially set it visibility to GONE:

android:visibility="gone" 

When you want to show this new EdiText, set

Edittext textNew=(TextView)mainView.findViewById(R.id.textNew); textOld.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub if (s.length()>=1) { textNew.setVisibility(View.VISIBLE); } } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub } }); 
Sign up to request clarification or add additional context in comments.

Comments

0

you need to use a TextWatcher a TextWatcher will watch your EditText for any user interaction use the onTextChanged method to detect user started typing here is how to do it

myedittext.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub //here add your code editetext2.setVisibility(View.VISIBLE); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub } }); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.