I have a "SignUpActivity" where user can sign in to my application, in some rare cases (I got only a few from Fabric, Crashlytics) that this particular activity is finishing before a dialog is shown. To clarify this, check the code below:

```
  private void register() {
    final ProgressDialog dialog = new ProgressDialog(this);
    dialog.setTitle("Registering");
    dialog.setMessage("Please wait..");
    if (dialogReady(dialog)) {
        dialog.show();
    }
    final AlertDialog alert = new AlertDialog.Builder(this)
            .setTitle("Error Occured")
            .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                }
            }).create();

    new ApiService(this).signUp(signUpModel).enqueue(new Callback<Void>() {
        @Override
        public void onResponse(Call<Void> call, Response<Void> response) {
            if (response.isSuccessful()) {
                //code
                finish();
            } else {
                if (dialogReady(dialog) && dialogReady(alert)) {
                    dialog.dismiss();
                    alert.setMessage(response.message());
                    alert.setMessage("Email already exists");
                    alert.show();
                }
            }
        }

        @Override
        public void onFailure(Call<Void> call, Throwable t) {
            if (dialogReady(dialog) && dialogReady(alert)) {
                dialog.dismiss();
                alert.setMessage("Check your internet connection");
                alert.show();
            }
        }
    });
}

```

How I managed to recreate the problem is by setting "Don't keep activities" in the Developer options. I managed to fix this by using the dialogReady method I created:

```
 private boolean dialogReady(Dialog dialog) {
    return (dialog != null && !this.isFinishing());
}

```

However, I'm really curious to know why my activity is finished whnen clearly from the code there's no way (or there is) for it to finish before a dialog is shown or dismissed. I checked Crashlytics and all the devices have 30+% of RAM available and the activity itself is pretty simple and doesn't use much Memory anyway.

This also popped when referencing an Activity. I have an activity, let's call it A. A opens an activity B, which uses a static variable from A, call it A.listener. When assigning it to a new instance of that listener in the activity B, it throws a null pointer exception on A. I couldn't recreate that with "Don't keep activities" and this only happens on a few devices.

How can I perhaps think of a way to recreate the problem. A good process I could follow to debugging this rare problem.

Thank you.

EDIT: The call I'm doing (new ApiService....) is an async *request* \*(using retrofit)