我无法关闭警报对话框.我正在使用布局充气器进行对话,所以我不确定在完成它之后我会怎样关闭它.代码如下:
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();
Run Code Online (Sandbox Code Playgroud)
我无法调用完成,因为它关闭了启动警报对话框的列表视图,并且对我无法使用dialog.dismiss调用.
您认为我应该怎么做才能解决这个问题?