android--Service

来源:互联网 发布:js从小到大排序 编辑:程序博客网 时间:2024/05/21 10:58

出处:http://blog.csdn.net/ithomer/article/details/7364024

 

Service

不能自己运行只能后台运行,并且可以和其他组件进行交互。

 

Service的启动有两种方式:context.startService() context.bindService()

 

context.startService() 启动流程:

context.startService()  -> onCreate()  -> onStart()  -> Service running  -> context.stopService()  -> onDestroy()  -> Service stop

context.bindService()启动流程:

context.bindService()  -> onCreate()  -> onBind()  -> Service running  -> onUnbind()  -> onDestroy()  -> Service stop

0 0
原创粉丝点击