Error : BinderProxy@45d459c0 is not valid; is your activity running?
This is most likely happening because you are trying to show a dialog after execution of a background thread, while the Activity is being destroyed.
I was seeing this error reported once in a while from some of my apps when the activity calling the dialog was finishing for some reason or another when it tried to show a dialog. Here's what solved it for me:
if(!((Activity) context).isFinishing())
{
//show dialog
}
I've been using this to work around the issue on older versions of Android for several years now, and haven't seen the crash since.
I faced the same problem and used the code proposed by DiscDev above with minor changes as follows:
if (!MainActivity.this.isFinishing()){
alertDialog.show();
}
if dialog is trowing this problem because of the thread you should do run this on UI thread like that :-
runOnUiThread(new Runnable() {
@Override
public void run() {
dialog.show();
}
});