I am using this alert dialog:
public void displayAlert()
{
new AlertDialog.Builder(getActivity()).setMessage(R.string.invitenotice)
.setTitle("Invite Notice")
.setCancelable(true)
.setNeutralButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton){
finish();
}
})
.show();
}
my problem is when I click ok I don't want to use finish(); I just want to dismiss the dialog. Any help is appreciated. Or maybe a more simple way of creating a simple dialog box when I press a button ? Thanks everyone. Also, a problem is I get 4-6 instances of the dialog box. So i need to press ok 4-6 times until it dissapears. Where I put the listener to my button is here :
findViewById(R.id.mainHelp).setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
displayAlert();
return false;
}});
in the onCreate() method