我是安卓新手。我现在想知道如何在主页中创建状态通知栏。谁能帮我一些代码。提前致谢。
notificationManager = (NotificationManager)_context.getSystemService(Context.NOTIFICATION_SERVICE);
long when = System.currentTimeMillis();
int _icon=R.drawable.icon;
Intent intent = new Intent(_context, your_file.class);
PendingIntent contentIntent = PendingIntent.getActivity(_context, 0, intent, 0);
Notification notification = new Notification(_icon,_text,when);
notification.setLatestEventInfo(_context, _title, _contentText, contentIntent);
int NOTIFICATION_ID = 10;
notificationManager.notify(NOTIFICATION_ID, notification);
取消通知
notificationManager.cancel(NOTIFICATION_ID);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)