设为首页 加入收藏

TOP

一个Demo学完Android中所有的服务(二)
2014-11-24 08:24:44 来源: 作者: 【 】 浏览:4
Tags:一个 Demo 学完 Android 有的 服务
ew){
/**单击按钮时启动服务*/
Intent intent = new Intent(MainStadyServics.this,UseBrider.class);
startActivity(intent);
Log.v("MainStadyServics", "start Binder Service");
}
};
/**打开广播学习的按钮*/
public Button.OnClickListener broadcastReceiver = new Button.OnClickListener(){
public void onClick(View view){
Intent intent = new Intent(MainStadyServics.this,UseBroadcast.class);
startActivity(intent);
Log.v("MainStadyServics","start broadcast");
}
};
/**打开通知*/
public Button.OnClickListener notification = new Button.OnClickListener(){
public void onClick(View view){
Intent intent = new Intent(MainStadyServics.this, UseNotification.class);
startActivity(intent);
Log.v("MainStadyService ","start Notification");

}
};
/**使用闹钟*/
public Button.OnClickListener startAlarm = new Button.OnClickListener(){
public void onClick(View view){
Intent intent = new Intent(MainStadyServics.this, UseAlarmManager.class);
startActivity(intent);
Log.v("MainStadyService ","start alarm");

}
};
public Button.OnClickListener handler= new Button.OnClickListener(){
public void onClick(View view){
Intent intent = new Intent(MainStadyServics.this, UseHandleMessage.class);
startActivity(intent);
Log.v("MainStadyService ","start handle");
}
};
public Button.OnClickListener async= new Button.OnClickListener(){
public void onClick(View view){
Intent intent = new Intent(MainStadyServics.this, UseAsyncTask.class);
startActivity(intent);
Log.v("MainStadyService ","start handle");
}
};
public Button.OnClickListener phonestate= new Button.OnClickListener(){
public void onClick(View view){
Intent intent = new Intent(MainStadyServics.this, UsePhoneState.class);
startActivity(intent);
Log.v("MainStadyService ","start phonestate");
}
};
public Button.OnClickListener callphoneEvent= new Button.OnClickListener(){
public void onClick(View view){
Intent intent = new Intent(MainStadyServics.this, UseActionCall.class);
startActivity(intent);
Log.v("MainStadyService ","start callphone");
}
};
public Button.OnClickListener vibrator= new Button.OnClickListener(){
public void onClick(View view){
Intent intent = new Intent(MainStadyServics.this, UseVibrator.class);
startActivity(intent);
Log.v("MainStadyService ","start callphone");
}
};
/***/
protected void onDestroy(){
super.onDestroy();
Intent intent = new Intent(MainStadyServics.this,CountService.class);
/**退出Activity是,停止服务*/
stopService(intent);
}


}


首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Android中SQLite构造函数参数Cont.. 下一篇100多个Android Demo的整合下载

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·如何从内核协议栈到 (2025-12-27 03:19:09)
·什么是网络协议?有哪 (2025-12-27 03:19:06)
·TCP/ IP协议有哪些 (2025-12-27 03:19:03)
·怎样用 Python 写一 (2025-12-27 02:49:19)
·如何学习python数据 (2025-12-27 02:49:16)