매우 이상한 문제가 있습니다. 대화 상자에 editText가 있습니다. 한 번 (ListView의 요소를 두드리는) 대화 상자를 열고 모든 항목을 확인하면됩니다. 다음에 (ListView의 다른 요소를 가볍게 두드려) 대화 상자를 열면 editText는 처음 동일한 값을 표시합니다.EditText에 잘못된 텍스트가 표시됩니다.
toast(profilesList.get(toEdit).get(NAME).toString()); //toast say Bob
et_profileName.setText(profilesList.get(toEdit).get(NAME).toString()); //I see Alice
또 다른 이상한 점 : 디스플레이를 회전하면 "BobAlice"의 텍스트가 바뀝니다. 대화 상자를 닫은 다음 다시 열면 모든 것이 올바르게 작동하고 대화 상자에 올바른 문자열이 표시됩니다.
제안 사항?
편집 : et_profileName은 ListView에서 항목을 누르면 열리는 대화 상자에 있습니다. 나는 et_profileName.setText 전에
et_profileName= (EditText)dialog.findViewById(R.id.et_profileName);
를 넣어 경우
또한showDialog(DIALOG_EDIT_PROFILE);
toast(profilesList.get(toEdit).get(NAME).toString());
et_profileName.setText(profilesList.get(toEdit).get(NAME).toString());
이 (작동하지 않습니다
더 코드 : 나는 대화 상자를 호출 할 때 다음
protected Dialog onCreateDialog(int id) {
dialog = new Dialog(this);
...
et_profileName= (EditText)dialog.findViewById(R.id.et_profileName);
...
}
입니다 ...)
et_profileName이 첫 번째 EditText를 참조합니다. – Rodrigo
ListView에서 EditText를 사용합니까? 또는 ListView에서 항목을 클릭하면 열리는 대화 상자에 있습니다. – Noel
제안 사항은 더 많은 코드를 추가하는 것입니다. –