简体   繁体   English

无需任何方法调用即可在绑定服务中调用onStart方法

[英]onStart method is being called in a bound service without any method call

I have been going through the following google tutorial , and just had a few questions: 我一直在阅读以下Google教程 ,并且有几个问题:

  1. i pasted the code and ran it, and i noticed that the onStart() method gets executed. 我粘贴了代码并运行了它,然后我注意到onStart()方法被执行了。 However I do not see any method call for this, how does this method get executed ? 但是我看不到有任何方法调用,该方法如何执行?

  2. can you give an practical example of how a bound service would be ideal ? 您能否举一个实际示例说明绑定服务将如何理想?

  • That is because onStart() is called by an event, specifically, it is called when the activity becomes visible to the user. 这是因为onStart()是由事件调用的,具体地说,是当活动对用户可见时才调用它。

Here's a nice explanation of the lifecycle of Android activities : 这是Android活动生命周期的一个很好的解释

Android Activity Licecycle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM