How to acquire the Context in an Adobe AIR Native Extension?

Posted by rotaercz on Stack Overflow See other posts from Stack Overflow or by rotaercz
Published on 2012-10-05T21:34:44Z Indexed on 2012/10/05 21:37 UTC
Read the original article Hit count: 163

In the following line of code...

ProgressDialog progressDialog = ProgressDialog.show(getBaseContext(), "LOADING_TITLE", "LOADING_MESSAGE");

In place of getBaseContext() I've tried...

getApplicationContext()
this
NativeActivity.this
(NativeActivity)getApplicationContext()

Among others. I'm not sure why it's not working. In the NativeExtensionContext which extends FREContext I am passing the activity using getActivity() to NativeActivity. Everything works well but I get a "Nullpointerexception" or “android.view.WindowManager$BadTokenException: Unable to add window — token null is not for an application” when I try I try to get a reference to the Context.

Anyone with experience using Adobe AIR Native Extensions and/or Android Java would be great.

© Stack Overflow or respective owner

Related posts about java

Related posts about android