Why Custom Dialog Box Button Is Not Working In Android
We have creating two custom dialog box, one is about and another one is alert. When i choose alternately in the tow custom dialog box at that time the button is not working. Sample
Solution 1:
you are calling dialog as showDialog(int)
. remove this line dialog.show();
in your onCreateDialog
and call dismissDialog(int)
to dismiss the dialog instead of dialog.dismiss();
Solution 2:
Do like this:
Button button1=(Button) findViewById(R.id.btn1);
Button button2=(Button) findViewById(R.id.btn2);
button1.setOnClickListener(this);
button2.setOnClickListener(this);
implement your Activity by OnClickListener and add unimplemented method which u will get as onClick.
publicvoidonClick(View v) {
switch(v.getId()){
case R.id.btn1:
//write codebreak;
case R.id.btn2:
//write codebreak;
}
}
Do whatever you want to do on click event of button.
Post a Comment for "Why Custom Dialog Box Button Is Not Working In Android"