Vamsi Vamsi - 1 year ago 75
Android Question

Move focus from one Edit text box to another

I am writing a simple calculator application(using absolute layout with 3 edit boxes and some buttons), which has two inputtext boxes and a output box.

input1 = (EditText) findViewById(;
input2 = (EditText) findViewById(;

now once user enters some numerics into input1 and presses '+', now i want to shift the focus from input1 to input2. How can i do that?

I tried the below code on keypress of '+'

onClick(View arg0){

//Move focus from input1 to input2

but this is not working.. can you please help me on this?

Answer Source

Well, I found the answer: we can simply call input2.requestFocus(); to change the focus.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download