try this my friend
create one xml layout file like this
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:layout_marginLeft="60dp"
android:layout_marginRight="60dp"
android:layout_marginTop="20dp"
android:orientation="horizontal"
android:weightSum="4">
<EditText
android:id="@+id/edDigit1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:hint="1"
android:imeOptions="actionNext"
android:inputType="number"
android:maxLength="1" />
<EditText
android:id="@+id/edDigit2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:hint="2"
android:imeOptions="actionNext"
android:inputType="number"
android:maxLength="1" />
<EditText
android:id="@+id/edDigit3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:hint="3"
android:imeOptions="actionNext"
android:inputType="number"
android:maxLength="1" />
<EditText
android:id="@+id/edDigit4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:hint="4"
android:imeOptions="actionNext"
android:inputType="number"
android:maxLength="1" />
</LinearLayout>
**now in your activity file**
EditText edDigit1, edDigit2, edDigit3, edDigit4;
edDigit1 = (EditText) findViewById(R.id.edDigit1);
edDigit2 = (EditText) findViewById(R.id.edDigit2);
edDigit3 = (EditText) findViewById(R.id.edDigit3);
edDigit4 = (EditText) findViewById(R.id.edDigit4);
edDigit1.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (edDigit1.getText().toString().equals("")) {
edDigit1.requestFocus();
} else {
edDigit2.requestFocus();
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
edDigit2.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (edDigit2.getText().toString().equals("")) {
edDigit2.requestFocus();
} else {
edDigit3.requestFocus();
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
edDigit3.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (edDigit3.getText().toString().equals("")) {
edDigit3.requestFocus();
} else {
edDigit4.requestFocus();
}
}
@Override
public void afterTextChanged(Editable s) {
}
});