Android开发:对话框窗口与Java数据结构实践
1. Android对话框窗口实现
1.1 第一个对话框
在开发中,我们会创建新的笔记对话框。以下是相关代码:
Note newNote = new Note();
// Set its variables to match the
// user's entries on the form
newNote.setTitle(editTitle.getText().toString());
newNote.setDescription(editDescription.getText().toString());
newNote.setIdea(checkBoxIdea.isChecked());
newNote.setTodo(checkBoxTodo.isChecked());
newNote.setImportant(checkBoxImportant.isChecked());
// Get a reference to MainActivity
MainActivity callingActivity = (MainActivity) getActivity();
// Pass newNote back to MainActivity
callingActivity.createNewNote(newNote);
// Quit the dialog
dismiss();
目前我们完成了第一个对话框,但还未将其与 MainActivity 关联,并且需要实现 createNewNote
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



