LayoutInflater inflater = getLayoutInflater();
final View layout = inflater.inflate(R.layout.config,
(ViewGroup) findViewById(R.id.tableView));
new AlertDialog.Builder(v.getContext()).setTitle("设置选项").setView(layout)
.setPositiveButton("设置", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which){
EditText add=(EditText)layout.findViewById(R.id.address_c);
EditText po=(EditText)layout.findViewById(R.id.port_c);
if(add!=null&&po!=null)
{
if(add.getText().toString()!=""&&po.getText().toString()!="")
insertConfigData(add.getText().toString(),po.getText().toString());
}
//String address=add.getText().toString();
//String port=po.getText().toString();
//将获取的值组装成一条记录插入到数据库中
/*
emptyTable();
insertConfigData("122.205.129.39","8080");
*/
return;
}})
.setNegativeButton("取消", null).show();
一样的获取啊,只是把id封装一下,传递过去就行了。