我有一个AlertDialog.Builder
里面有一个按钮,我想在点击它时关闭对话框。
但是没有.dismiss()
or.cancel()
方法。
LayoutInflater inf = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inf.inflate(R.layout.map_window, null);
window = new AlertDialog.Builder(activity);
window.setCancelable(true);
buttonStar = (ImageButton)layout.findViewById(R.id.buttonStar);
buttonStar.setBackgroundResource(R.drawable.star);
buttonStar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
//finishing window;
}
});
window.setPositiveButton("Volver", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int wichButton) {
}
});
window.show();
}