Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have 2 edittext in my form design. what i want to acheive is that in the first edittext after typing few characters say for example i type "abc", the focus should automatically shift to the next edittext
i used the following code but cant get it right
Java
gtin=(EditText) findViewById(R.id.editText1);
		expiry=(EditText) findViewById(R.id.editText2);
		String sgtin=gtin.getText().toString();
		if(sgtin.length()==3){
			expiry.findFocus();
			//expiry.requestFocus();
		}
Posted

1 solution

You need to a implement a listener for text change event, see example:
http://www.mysamplecode.com/2012/06/android-edittext-text-change-listener.html[^]
To set focus on an editext, try:
editText.requestFocus();
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900