Here is my Dialog box
public class CustomDialogClass extends Dialog implements
android.view.View.OnClickListener {
public Activity c;
public Dialog d;
public Button no;
CheckBox yes;
boolean p;
public CustomDialogClass(Activity a) {
super(a);
// TODO Auto-generated constructor stub
this.c = a;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.custom_dialog);
yes = (CheckBox) findViewById(R.id.checkBox1);
no = (Button) findViewById(R.id.btn_no);
no.setOnClickListener(this);
yes.setChecked(false);
yes.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.checkBox1:
yes.setChecked(true);
break;
case R.id.btn_no:
dismiss();
break;
default:
break;
}
}
}
Now, I open the dialog and check the checkbox, click on button and dismiss the dialog. But When I open it again, the checkbox is again unchecked. what should i do?