Andorid Notification--不用启动Activity的通知
来源:互联网 发布:淘宝美工自学好学吗 编辑:程序博客网 时间:2024/06/08 09:12
http://blog.csdn.net/suchto/article/details/6643529
不启动Activity的通知,我目前得到的方法得益于对RemoteView的使用:
代码如下:
noti_layout.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="3dp"
>
<ImageView android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginRight="10dp"
/>
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:textColor="#000"
/>
</LinearLayout>
...........................................
java部分代码如下:
private void MakeNotification2() {
String tickerText = "tickerText";
NotificationManager NoteManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.icon, tickerText, System.currentTimeMillis());
RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.noti_layout);
contentView.setImageViewResource(R.id.image, R.drawable.icon);
contentView.setTextViewText(R.id.text, "Hello, this message is in a custom expanded view");
notification.contentView = contentView;
Intent notificationIntent = new Intent(this, RemoteViews.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.contentIntent = contentIntent;
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.defaults |= Notification.DEFAULT_SOUND;
NoteManager.notify(id++, notification);
}
- Andorid Notification--不用启动Activity的通知
- Andorid Notification--不用启动Activity的通知
- activity间的动画,系统通知nOTIFICATION
- Activity之Notification(通知)
- android点击系统通知Notification,进入指定的activity
- Android -- Notification,如何向通知栏发送通知,点击通知开启相应的Activity
- Andorid的Activity的四种启动模式详解
- notification栏增加常驻通知以及开机启动的处理
- Notification通知的详解
- Notification通知的使用
- 使用一个Notification启动Activity
- notification 点击响应 以及启动activity的坑
- Android中使用Notification并通过点击Notification启动启动通知详细Activity,点击返回键和按钮返回主界面
- 通知栏通知:Notification的实现
- Notification消息通知 通知栏的实现
- android通知栏的消息通知(Notification)
- Andorid Activity的本质是什么
- Android Notification多个通知跳转Activity总会被最后一个替换的问题
- 唐伯虎诗集
- Hadoop公平调度器算法解析
- android体系结构介绍
- 宠达人
- 如果我再年轻几岁~
- Andorid Notification--不用启动Activity的通知
- Android:屏幕的锁定和取消锁定 and Android:点亮屏幕,和取消点亮屏幕
- S3C6410 存储器映射存储器映射
- 透明 input
- Linux查看CPU和内存使用情况
- 《青年文摘》经典语句摘录
- 求资料,关于compactlogix,
- Python中os.system()的返回值
- 悲催,什么原因会使得结果如此悲催?