AlertDialog inside onClickListener
Change this line
new AlertDialog.Builder( this );
to
new AlertDialog.Builder( YourActivity.this );
This is because the constructor needs a Context type & OnclickListner is not a Context type
so you use the object of your Activity.
I hope it helps..