두 명의 청취자를 동시에 가질 수 있습니까?Android java edittext에 대한 두 명의 자
내가 어떤 초점을 얻을 때
<EditText
android:id="@+id/editTextnum"
android:layout_width="0sp"
android:layout_height="50dp"
android:paddingLeft="10dp"
android:imeOptions="actionDone"
android:background="@drawable/back"
android:textSize="30dp"
android:ems="10"
android:textColor="#000000"
android:layout_weight="1"
android:inputType="number">
<EditText
android:id="@+id/editTextnum2"
android:layout_width="0sp"
android:layout_height="50dp"
android:paddingLeft="10dp"
android:layout_weight="1"
android:background="@drawable/back"
android:ems="10"
android:imeOptions="actionDone"
android:inputType="number"
android:textColor="#000000"
android:textSize="30dp">
을 다음과 같이 정의되는 두 글고이 중 하나의 I 완료 키를 누릅니다 숫자를 입력 할 수 있도록 부드러운 숫자 키패드를 제공합니다. 다음 코드는 EditTexnum에 초점을 맞추고있는 동안 수행 압박에서 실행되는 2
//Listner and result in MainActivity.java
db = new DBAdapter(this);
editText = (EditText) findViewById(R.id.editTextnum2);
editText.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId,
KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
EditText mEdit = (EditText)findViewById(R.id.editTextnum2);
if(mEdit.length()==0){
Toast.makeText(getBaseContext(), "No Fault Reference Number Entered", Toast.LENGTH_LONG).show();
}
else{
db.open();
Cursor c = db.getAsset2(mEdit.getText());
if (c.moveToFirst())
DisplayContact(c);
else
Toast.makeText(getBaseContext(), "No Fault Reference found", Toast.LENGTH_LONG).show();
}
db.close();
이 editTextnum2에 대한 완벽한 작동하지만
내가 텍스트를 복사하고 리스너를 변경 시도 리스너를 밤은 때문에 editTextnum 아무것도 할 나던하지만, 그것은
는 기본적으로 내가 뭐하는 거지 모자는 그들이 SQLite는 데이터베이스 검색 검색 상자하지만 그들은 두 개의 서로 다른 열
나는이 작업을 수행하는 방법을 어떤 생각에 검색하다하는 오류 던지는 kepps?
는 어떤 도움 당신은
당신 바인드 그것을
another_editText_var = (EditText) findViewById(R.id.editTextnum);
같은 다른 텍스트 상자에 대해 확인하고 같은 리스너를 등록 R.id.editTextnum2
에 editText
을 결합하는 마크
완벽한 작품을 보내 주셔서 감사합니다. – user3422687