[android-developers] Re: this.getApplication() returns NULL pointer

2009-10-09 Thread Dianne Hackborn
Are you calling it in the constructor? The activity is not yet fully initialized at that point. On Fri, Oct 9, 2009 at 2:28 AM, Stefan wrote: > > I'm running the following line in an Activity, which is within the > same application, but in a different package: > AppObject appObj = (AppObject)th

[android-developers] Re: this.getApplication() returns NULL pointer

2009-10-15 Thread Stefan
Nope. Right now, for testing purposes, it is triggered through a button click. I've also included android:name="AppObject" within the - tag of the Manifest. And the initialization of the AppObject seems to work properly. The only thing that doesn't work is calling AppObject appObj = (AppObject)t

[android-developers] Re: this.getApplication() returns NULL pointer

2009-10-15 Thread Dianne Hackborn
Oh if it isn't in the same package, of course that doesn't work -- it would return the application object for -its- package. On Thu, Oct 15, 2009 at 2:31 AM, Stefan wrote: > > Nope. Right now, for testing purposes, it is triggered through a > button click. > > I've also included android:name="Ap

[android-developers] Re: this.getApplication() returns NULL pointer

2009-10-15 Thread jotobjects
Does "this" refer to the OnClickListener button listener object? Often this is an inner member class of the activity so it would work if you take the "this." off. But you seem to have something a little more complicated going on. Maybe we need to see the OnClickListener code. On Oct 15, 9:59 am