I want to create a dialog box when a button is clicked inside the dialog box I need 2 radio buttons which are linked with mobile default music and other is external memory of the mobile. Anyone can help me out this here is my code as follows?
buttonSound = (Button) findViewById(R.id.btn_sound);
buttonSound.setOnClickListener (new OnClickListener(){
public void onClick(View v){
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
getApplicationContext());
Log.d("TAG","button inside mobile");
alertDialogBuilder
//.setMessage("Click yes to exit!")
.setCancelable(false)
.setPositiveButton("Sound",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
// if this button is clicked, close
// current activity
AlarmActivity.this.finish();
}
});
// builder.setPositiveButton("Sound", );
alertDialogBuilder
//.setMessage("Click yes to exit!")
.setCancelable(false)
.setPositiveButton("SdCard",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
// if this button is clicked, close
// current activity
Log.d("TAG","button inside sdCard");
AlarmActivity.this.finish();
}
});
alertDialogBuilder.show();
And it is showing error as follows given below
android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application