【发布时间】:2013-03-26 21:04:11
【问题描述】:
我的选项菜单中有一个“搜索”按钮,它显示了一个带有搜索掩码的对话框。 因此,当您单击“搜索”按钮时,它应该会开始实际搜索。
我在 onCreateDialog 中尝试做的是:
Button search_button = (Button) dialog.findViewById(R.id.d_search_button);
search_button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
EditText text = (EditText) v.findViewById(R.id.d_search_text);
}
});
由于 text 为空,哪个不起作用,那么访问搜索文本的最佳方法是什么?
【问题讨论】:
标签: android dialog onclick android-edittext