thanks mark,
I am starting service in myactivity::OnDestroy. When activity is
opened again, I am maintaining flag in preference that service has
started. If that flag is set, then i am stopping service (or starting
service with stopself parameter in intent as per yr suggestion in
diff. thread in group) from MyActivity::OnCreate. after that i need to
use two integer values(kind of key values to get more data from that
from database file)
When i am stopping service(2nd time activity get started and service
running) I require latest value two integers from service.
How can i get those values in activity from service without waiting
for service to stop?
One more question, In myactivity, i have handler which implements
handlemessage(), is it possible to receive msg in it from service?
private Handler handler = new Handler()
{
@Override
public void handleMessage(Message msg) { // handling message from
thread }
}
Thanks in advance.
JC
On Dec 21, 2:03 pm, Mark Murphy <[email protected]> wrote:
> On Tue, Dec 21, 2010 at 1:00 AM, JC <[email protected]> wrote:
> > Yes i realize that too. that Service::OnCreate and OnDestroy is called
> > after Activity::OnCreate and OnDestroy always.
>
> > Then what/how can we get resultant data from service ?
>
> What is "resultant data"?
>
> Your service can communicate with the activity via a PendingIntent
> from createPendingResult(), or a broadcast Intent, or a Messenger
> object, etc., any of which can be passed as an extra in the Intent you
> supply via startService().
>
> --
> Mark Murphy (a Commons
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
> Available!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en