私は2つのremoteViewsを持っています
- 通知内容について
- 通知ティッカー用(これは機能しないと思います)
2のコードは含めていません。コンテンツが機能するようになったら、2を試してみます。
以下のコード
Intent intent = new Intent(this, HomeScreen.class);
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);
RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.pickupnotification);
RelativeLayout pickupNotificationLayout = (RelativeLayout)this.getLayoutInflater().inflate(R.layout.pickupnotification, null) ;
TextView title = (TextView)pickupNotificationLayout.findViewById(R.id.title) ;
TextView countDown = (TextView)pickupNotificationLayout.findViewById(R.id.countDown) ;
TextView from = (TextView) pickupNotificationLayout.findViewById(R.id.from) ;
TextView to = (TextView) pickupNotificationLayout.findViewById(R.id.to) ;
contentView.apply(this, pickupNotificationLayout);
title.setText("Siddharth" + "2km -> 20km");
countDown.setText("-1:29") ;
from.setText("FROM 2:00pm 14th Jan 2013, Some address") ;
to.setText("TO 4:00pm 14th Jan 2013 Some address") ;
Notification noti = new NotificationCompat.Builder(this).setContent(contentView)
.setSmallIcon(R.drawable.notification_logo)
.setContentIntent(pIntent)
.build();
NotificationManager notificationManager =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
noti.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(0, noti);