开发者

Can an android Service update an Activity-GUI other than the one it was called by?

1. I have 2 Activities,

class A { I have called a service}

class Service {I am running in the background. I was called by Class A, but I want to bring Class B in front and add text to Class B}

Class B { I have a nice GUI}

2. How can I effectively kill "class Service" (from above question), it has a while loop and listening to incoming messages (sent by myServer) ? Please provide me example with say, when a Button in Class A is clicked... how to check if there is a service already running?!!! [cause, if I hit hardware back key, class A goes off, still service is running, which is expected for me.]

Te开发者_JAVA百科aring my hairs..

Thank you all...


You can call startActivity() (http://developer.android.com/reference/android/content/Context.html#startActivity%28android.content.Intent%29) using an Intent and then pass the data for Activity B in the Intent's extras package.

See the http://developer.android.com/reference/android/content/Context.html#stopService%28android.content.Intent%29 for details on stopping the service.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜