2014-12-13 70 views
0

我想要定製bigContentView進行中的通知。沒有bigContenView的Custom RemoteViews工作得很好。然而,當我試圖此bigContentView添加到它,Eclipse的說bigContentView無法解析或不是字段?

「bigContentView不能得到解決或不是場」

有人可以幫我嗎?

這裏是我的代碼:

public void PlayTimeOnGoingProgressStatusBar() {   
     NotificationCompat.Builder OnGoingProgress = new NotificationCompat.Builder(this); 
     RemoteViews remotetView = new RemoteViews(getPackageName(), R.layout.custom_notification); 
     OnGoingProgress.setSmallIcon(R.drawable.app_name).setContent(remotetView); 
     OnGoingProgress.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher)); 
     OnGoingProgress.setContent(remotetView); //Place all custom notifications to here 
     OnGoingProgress.setOngoing(true); //Create OnGoing Status Bar 
     OnGoingProgress.setAutoCancel(false); 

     OnGoingProgress.bigContentView = remotetView; //THIS IS THE ONE THAT GIVES ME PROBLEM 

     remotetView.setTextViewText(R.id.App_name, 「Test」); 
     remotetView.setProgressBar(R.id.status_progress, total_time, current_prgoress, false); 
     NotificationManager.notify(PROGRESS_STATUS_BAR_ID, OnGoingProgress.build()); 
} 

非常感謝你提前

回答

1

用這個代替:

Notification note = OnGoingProgress.build(); 
note.bigContentView = remoteView; 
NotificationManager.notify(... note); 

原因:大內容視圖是通知類的字段,而不是建造者班。

+0

花了我幾個小時,但我從來沒有想過自己。我遵循你的解決方案,它的作品!我即將哭泣。非常感謝你的善意和幫助!祝你聖誕快樂,新年快樂 – 2014-12-13 22:27:09