My Activity is trying to create an AlertDialog which requires a Context as a parameter. This works as expected if I use:
AlertDialog.Builder builder = new Al
I think it may happen as well if you are trying to show a dialog from a thread which is not the main UI thread.
Use runOnUiThread() in that case.
runOnUiThread()