During testing, I have shutdown all processes including the application
before shutting down the phone.
When I power up the phone I can see that the application has been
restarted and is resident, so I should be able to get the activity
shouldn't I?
On 12/06/2011 9:51 AM, Kostya Vasilyev wrote:
There may not be an instance of your activity - definitely not when
we're talking about processing boot_completed.
At that point, the only components involed are a broadcast receiver
and possibly your wakeful intent service (IIRC). Since the user at
that point has never run your application, there aren't any activities
that have been constructed.
So - don't rely on an instance of Activity subclass to initialize your
statics.
You can use a lazy-initializable singleton (mine and many others'
preferred solution) or use an Application subclass and its onCreate
method.
-- Kostya
2011/6/12 Simon Platten <simonaplat...@googlemail.com
<mailto:simonaplat...@googlemail.com>>
Hi,
I've managed to find out why my application wasn't restarting
correctly after a boot up and it was an uninitialised array that
is normally set-up by the main activity when the application starts.
The question now is....how do I get the main application activity?
The reason it isn't so straight forward is that I've created a
library which I use in several similar applications, in the
library I have a base activity class which provides core
functionality, in that class I have defined an abstract method
called 'setupArray'.
The name of the derived activity class may be different in each
application. What I would like to do is get a reference to the
application activity from within the library then call the
setupArray method to ensure the array is set-up from the reboot
onReceive method.
Does that make sense?
--
Regards,
Sy
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to
android-developers@googlegroups.com
<mailto:android-developers@googlegroups.com>
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
<mailto:android-developers%2bunsubscr...@googlegroups.com>
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en