2013-10-12 85 views
0

我有我的代码波纹管。当代码执行时,通知将显示,但远程视图不会显示。android通知remoteviews不显示

我的意思是我在notifaction中看不到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); 
+0

你的问题不清楚。 – GrIsHu

回答

1

调用setLatestEventInfo()覆盖您的自定义contentView。将它移动到第3行,或者更好,切换到Notification.Builder api。

-1

尝试在您的代码中设置notification.icon。只设置notification.contentView不能在通知中看到它。