Getting the context inside onClick(View view), the callback for a button\'s onClickListener(), is easy:
onClick(View view)
onClickListener()
view.getContext() >
view.getContext()
inside setOnClickListener
decelare this below the class
Context context = this;
and use this context
AlertDialog.Builder alertDialog = new AlertDialog.Builder(context);