Android 通知栏
来源:互联网 发布:勇敢的心 手游 知乎 编辑:程序博客网 时间:2024/06/06 02:08
public class MainActivity extends AppCompatActivity { private NotificationManager nm; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //1 获取NotifycationManager的实例 nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); } // 点击按钮发送一条通知 public void click1(View v) { // 链式调用 //创建意图对象 Intent intent = new Intent(); //实现拨打电话的功能 intent.setAction(Intent.ACTION_CALL); intent.setData(Uri.parse("tel:"+119)); PendingIntent pendingIntent = PendingIntent.getActivity(this, 10, intent, PendingIntent.FLAG_UPDATE_CURRENT); Notification notification = new Notification.Builder(this) .setContentTitle("大标题") .setContentText("标题的内容") .setSmallIcon(R.mipmap.ic_launcher) .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher)) .setContentIntent(pendingIntent) .build(); nm.notify(10, notification); } // 点击按钮 取消发送一条通知 public void click2(View v) { // 取消通知 nm.cancel(10); }}
0 0
- Android通知栏通知
- android通知栏进度条
- android 通知栏处理
- android 打开通知栏
- Android 通知栏 Notification
- android显示通知栏
- android通知栏提示
- android通知栏提示
- android通知栏提示
- android通知栏广告
- android NotificationManager 通知栏
- Android 通知栏消息
- Android 通知栏消息
- android通知栏总结
- Android通知栏
- Android通知栏
- Android收起通知栏
- Android 通知栏
- win10安装linux虚拟机+hadoop2.7.3
- GAME START
- 题目:输入一个整数n,求从1到n这n个整数的十进制表示中1出现的次数。(google面试题) 例如 输入12,从1到12这些整数中包含1 的数字有1,10,11和12,1一共出现了5次。 分析
- 关于Linux进程你所需要知道的一切
- 预置分频器
- Android 通知栏
- Google Earth 点击地标时,程序崩溃的问题
- python(1)缩进
- Delphi控件手工安装方法
- linux命令行下载BT种子和磁力链接
- .通过编程实现,统计1~n有多少个9 (n通过参数传入)
- Android Notification.setLatestEventInfo弃用和Notification.Builder用法
- 循环与数组问题
- 课堂笔记_ 明暗处理、视点变换