我无法关闭我的警报对话框。 我使用布局填充器来创建对话框,因此我不确定在完成后如何关闭它。 以下是代码:
AlertDialog.Builder dialog = new AlertDialog.Builder(AddData.this);
DialogInterface dia = new DialogInterface();
//Create a custom layout for the dialog box
LayoutInflater inflater = (LayoutInflater)AddData.this.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.add_rep_1_set, parent, false);
TextView title = (TextView)layout.findViewById(R.id.rep_1_title);
Button add_item = (Button)layout.findViewById(R.id.add_button);
add_item.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
//Need this to close the alert dialog box
}
});
title.setText(workout_items[position]);
dialog.setView(layout);
dialog.show();
我无法调用finish方法,因为这将关闭启动对话框的ListView且我不能使用dialog.dismiss方法。
你认为我该怎么做来解决这个问题呢?
DialogInterface dia
是用来做什么的? - ghchoi