modified createDialog to receive as parameter an OnClickListener