状态栏发送通知
来源:互联网 发布:js字符串转义函数 编辑:程序博客网 时间:2024/06/05 18:16
public class SendNotification extends Activity { private NotificationManager nm; private Button btnSend; private Button btnCancel; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setupViews(); } private void setupViews() { btnSend = (Button) findViewById(R.id.send); btnCancel = (Button) findViewById(R.id.cancel); String service = Context.NOTIFICATION_SERVICE; nm = (NotificationManager) getSystemService(service); // get system service final Context context = SendNotification.this; btnSend.setOnClickListener(new OnClickListener() { public void onClick(View v) { Notification n = new Notification(); n.icon = R.drawable.icon; n.tickerText = "Notification"; n.when = System.currentTimeMillis(); //n.flags=Notification.FLAG_ONGOING_EVENT; Intent intent = new Intent(context, SendNotification.class); PendingIntent pi = PendingIntent.getActivity(context, 0, intent, 0); n.setLatestEventInfo(context, "title","content", pi); nm.notify(1, n); } }); btnCancel.setOnClickListener(new OnClickListener() { public void onClick(View v) { nm.cancel(1); } }); } }
0 0
- 发送状态栏通知 Notification
- android 发送状态栏通知
- android-发送状态栏通知
- 状态栏发送通知
- android开发之向状态栏发送通知
- 程序发送和取消状态栏的通知
- Android发送一个通知到状态栏去
- android学习笔记---52_发送状态栏通知
- 状态栏通知
- Android 程式开发:(五)发送通知 —— 5.1“状态栏”Notification通知
- Android通知之状态栏通知
- 发送通知
- 创建状态栏通知 notification
- android 状态栏 通知
- Android 状态栏通知
- Notification(状态栏通知)
- Notification状态栏通知
- 状态栏中的通知
- 计算机网络参考模型
- Generate Parentheses
- Ubuntu 远程访问mysql数据库
- MyBatis集成Spring开发 讲解
- 反射机制
- 状态栏发送通知
- CSS3 Media Queries
- Oracle 高水位(HWM: High Water Mark)
- 《Go语言编程》【2.7 完整示例】的错误
- 《Go语言编程》【3.6 完整示例】代码错误和文件目录结构
- 《Cmake 实践》【初试 cmake – cmake 的 helloworld】CMakeLists.txt错误
- 《Go语言编程》[4.4 并发通信]代码thread.c和thread.go错误
- MariaDB(MySQL)修改表结构报表空间满
- Web服务器Nginx多方位优化策略