2013-10-12 88 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不能在通知中看到它。