Can anyone explain to me why this error occures, or even better how do I handle it? I can not reproduce it. It is one of those errors that happends once out of a 1000.
B
This can happen if the user either dismisses the view (e.g. a dialog that can be backed out of) or if the user switches to a different activity while your task is running. You should seriously think about using Android's activity-native dialog showing/dismissing instead of trying to keep a reference to the views yourself. But if you are handling it yourself, you may want to check if the dialog is actually showing using the dialog's isShowing() method before trying to dismiss it.