tags:

views:

86

answers:

1

I am trying to show custom alert from onActivityResult. I need to inflate it, so am getting context with getApplicationContext() and everything is fine until I execute alertDialog.show() - then it fails with:

Unable to add window -- token null is not for an application

Do you know why I cannot do it?

(it happens on 1.6 and 2.0 - I didn't test others)

A: 

I've found the sollution! This thread was very helpful: http://www.mail-archive.com/[email protected]/msg17294.html

I was doing:

Context mContext = getApplicationContext();
...
builder = new AlertDialog.Builder(mContext);

Instead of:

builder = new AlertDialog.Builder(this);
Michal Dymel