I have made a main Dialog
class on which I send the layout ID and shows the layout as a Dialog
now when I send the layout from calling class it pop
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setIcon(R.drawable.warning);
builder.setTitle("Warning");
final LinearLayout backAlarmDialogLayout = (LinearLayout) getLayoutInflater()
.inflate(R.layout.custumedialog_layou, null);
builder.setView(backAlarmDialogLayout);
builder.setCancelable(true);
backAlarmDialog = builder.create();
Set these codes to initialize your costumed dialog in onCreate like this, and if you would like to add listener to your button, you can write another method like
public void onClickCancel(View view){
backAlarmDialog.dismiss();
}
then you use
android:onClick="onClickCancel"
in the button in the XML.files you have costumed the dialog, I have tried other ways but they just would not work and I don not know why is this.Maybe someone would solve mine. ||= =