You can reference an outer context when you define your DialogInterface.OnClickListener as an anonymous class. If you’re in an activity you can use MyActivity.this as the context.
Edit – since your Activity is implementing DialogInterface.OnClickListener, you should be able to just use this as the context.