本文介绍了如何设置在Android状态栏通知文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不知道如何设置状态栏notifaction Android中请给一些想法
i dont know how to set status bar notifaction in android please give some idea
推荐答案您参考@spectrum:的 developer.android/guide/topics/ui/notifiers/notifications.html
@spectrum you will refer:developer.android/guide/topics/ui/notifiers/notifications.html
通知
Notification notification = new Notification( android.R.drawable.stat_sys_warning, //Icon to use "Hello World!", //Text System.currentTimeMillis() //When to display - i.e. now );创建的PendingIntent,当用户点击通知做点什么
Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse("www.stackoverflow")); PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0); //Add to the Notification notification.setLatestEventInfo( getApplicationContext(), "Stack Overflow", //Title of detail view "This will launch Stack Overflow", //Text on detail view pi ); //Display the Notification NotificationManager nm = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(ID_HELLO_WORLD, notification); //ID_HELLO_WORLD is a int ID更多推荐
如何设置在Android状态栏通知文本
发布评论