I get a leaked window error
You didn't posted relevant code but you need to call dismiss()
on your Dialog before you're going to next Activity - in that time Context of current Activity is going to null and this is reason why you're getting this kind of Exception.
So in your case, you can do it like:
final AlertDialog.Builder warning = new AlertDialog.Builder(this);
...
public void onClick(DialogInterface arg0, int arg1) {
warning.dismiss();
findView();
}
Just you need to make your Dialog as final field to be able to use it in method of anonymous class.