我的代码如下。代码执行时,会显示通知,但不会显示远程视图。
我的意思是我在通知中看不到 R.layout.layout_update_bar 。
mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotification = new Notification(R.drawable.close_icon,"Pet Parrot", System.currentTimeMillis());
mNotification.defaults = 4;
mRemoteView = new RemoteViews(getPackageName(), R.layout.layout_update_bar);
mNotification.contentView = mRemoteView;
mNotification.contentView.setProgressBar(R.id.progress,100,44,false);
mNotification.contentView.setTextViewText(R.id.title, "Siddharth" + "2km -> 20km");
//mNotification.flags |= Notification.FLAG_AUTO_CANCEL;
CharSequence contentTitle = "download";
Intent notificationIntent = new Intent(this,PhotoSaSa.class);
PendingIntent contentIntent = PendingIntent
.getActivity(this, 0, notificationIntent, 0);
mNotification.setLatestEventInfo(this, contentTitle,"", contentIntent);
mNotifyManager.notify(1, mNotification);