3
import android.app.Activity;
4
import android.os.Bundle;
5
import android.widget.Button;
6
import android.view.View;
7
import android.content.Intent;
8
import android.util.Log;
9
/**这是使用后台服务的学习例子*/
10 public class MainStadyServics extends Activity {
11
/**参数设置*/
12
Button startServiceButton;//
启动服务按钮
13
Button shutDownServiceButton;//
关闭服务按钮
14
Button startBindServiceButton;//
启动绑定服务按钮
15
Button sendBroadcast;//
使用广播
16
Button notificationButton;//
使用通知功能
17
Button alarmButton;//
使用闹钟
18
Button handlerButton;// 使用 handler
19
Button asyncButton;//
使用异步加载
20
Button phoneStateButton;//
查看手机状态
21
Button callphoneButton;//
拨打电话
22
Button vibratorButton;//
使用震动
23
CountService countService;
24
25
@Override
26
public void onCreate(Bundle savedInstanceState) {
27
super.onCreate(savedInstanceState);
28
Log.v("MainStadyServics", "setContentView");
29
setContentView(R.layout.main);
30
getWidget();
31
regiestListener();
32
}
33
/**获得组件*/
34
public void getWidget(){
35
startServiceButton = (Button)findViewById(R.id.startServerButton);
36
startBindServiceButton = (Button)findViewById(R.id.startBindServerButton);
37
shutDownServiceButton = (Button)findViewById(R.id.sutdownServerButton);
38
sendBroadcast = (Button)findViewById(R.id.sendBroadcast);
39
notificationButton = (Button)findViewById(R.id.notification);
40
alarmButton = (Button)findViewById(R.id.alarm);
41
handlerButton = (Button)findViewById(R.id.handler);
42
asyncButton = (Button)findViewById(R.id.async);
43
phoneStateButton = (Button) findViewById(R.id.phonestate);
44
callphoneButton = (Button) findViewById(R.id.callphone);
45
vibratorButton = (Button) findViewById(R.id.vibrator);
找软件资料,就到一览软件文库
http://wk.yl1001.com/rj/