There is no check for null values here. Later in onCreateDialog, these values are used without check for null values, resulting in NPE.