It seems to be there is no easy way to get an Alert dialog to return a simple value. This code does not work (the answer variable cannot be set
Declare a field 'answer' in your activity and set a value to it. Fields of a class are visible to inner classes, so you can do that.