Service 学习一

来源:互联网 发布:淘宝假物流单号怎么办 编辑:程序博客网 时间:2024/05/01 23:31

Service 是android 系统四大组件之一, 也被称为没有界面的activity, 调用一个service 一共有下面几个方法:

  1. 最简单的一种方式是直接启动服务

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent service = new Intent(this, MyService.class);
startService(service);
}
这里写代码片`

0 0
原创粉丝点击