KeyCode_Enter to next edittext

Posted by soclose on Stack Overflow See other posts from Stack Overflow or by soclose
Published on 2010-06-11T03:09:37Z Indexed on 2010/06/11 3:12 UTC
Read the original article Hit count: 271

Filed under:
|
|

Hi,

In edittext, after typing 'Enter' key, system make a new line inside it. I'd like to focus on next edittext, no new line. how to code? my code in xml is below

    <EditText
    android:id="@+id/txtNPCode"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textSize="18sp"
    android:layout_alignLeft="@+id/lblNPCode"
    android:layout_below="@+id/lblNPCode"
    android:layout_centerHorizontal="true"
/>
<EditText
    android:id="@+id/txtCNPCode"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textSize="18sp"
    android:layout_alignLeft="@+id/lblCNPCode"
    android:layout_below="@+id/lblCNPCode"
    android:layout_centerHorizontal="true"
    />  

I also caputer key code in setOnKeyListener

        tCNPCode.setOnKeyListener(new OnKeyListener() {

public boolean onKey(View v, int keyCode, KeyEvent event) { // TODO Auto-generated method stub if(keyCode == 66) { Toast.makeText(S_PCode.this, "Enter Key",
Toast.LENGTH_LONG).show(); //tNPCode.setFocusable(true);

}
return false;    

} });

© Stack Overflow or respective owner

Related posts about android

Related posts about edittext