안드로이드 개발 질문/답변
(글 수 45,052)
안녕하세요?
onCreateDialog 로 다이얼로그를 만들었는데요.
여기에 사용자에게 정보를 입력받고, OK 버튼을 누르면 그 정보를 가져와 db에 넣고 싶은데요.
아래처럼 ok 버튼에 onclick 버튼에 이벤트를 주고 여기에서 처리하면 될것 같은데,
factory.inflate(R.layout_dialog_new_category,null) <--- 여기에 있는 view의 정보를 어떻게 가져와야 할지 모르겠네요 -_-;;
답변 부탁드립니다.
소스코드 첨부합니다.
protected Dialog onCreateDialog(int id) {
switch (id) {
case NEW_CATEGORY:
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.dialog_new_category, null);
return new AlertDialog.Builder(Event.this)
.setTitle("New Category")
.setView(textEntryView)
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// 이벤트 처리ㅣ
}
})
.setNegativeButton("Cancle", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
})
.create();
}
return null;
}
onCreateDialog 로 다이얼로그를 만들었는데요.
여기에 사용자에게 정보를 입력받고, OK 버튼을 누르면 그 정보를 가져와 db에 넣고 싶은데요.
아래처럼 ok 버튼에 onclick 버튼에 이벤트를 주고 여기에서 처리하면 될것 같은데,
factory.inflate(R.layout_dialog_new_category,null) <--- 여기에 있는 view의 정보를 어떻게 가져와야 할지 모르겠네요 -_-;;
답변 부탁드립니다.
소스코드 첨부합니다.
protected Dialog onCreateDialog(int id) {
switch (id) {
case NEW_CATEGORY:
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.dialog_new_category, null);
return new AlertDialog.Builder(Event.this)
.setTitle("New Category")
.setView(textEntryView)
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// 이벤트 처리ㅣ
}
})
.setNegativeButton("Cancle", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
})
.create();
}
return null;
}