2013-04-26 88 views
1

有谁知道如何在下载文件时在通知栏中显示进度栏更新?通知错误“方法setProgress(int,int,boolean)未定义类型NotificationCompat.Builder”

Context context = MyClass.this.getApplicationContext(); 
    NotificationManager notificationManager = (NotificationManager) 
           context.getSystemService(NOTIFICATION_SERVICE); 
    Notification updateComplete = new Notification(); 
    updateComplete.icon   = R.drawable.ic_launcher; 
    updateComplete.tickerText = "Starting to download..."; 
    updateComplete.when   = System.currentTimeMillis(); 
    Intent notificationIntent = new Intent(context, MyClass.class); 
    PendingIntent contentIntent = PendingIntent.getActivity(context, 0, 
                 notificationIntent, 0); 
    String contentTitle   = "Download"; 
    updateComplete.setLatestEventInfo 
         (context, contentTitle, "downloading...", contentIntent); 
    notificationManager.notify("yyy",1, updateComplete); 
+0

我回复[建议编辑](http://stackoverflow.com/review/suggested-edits/1999128#./1999128),因为它是无效的。人们,如果你建议编辑,你为什么要改弦乐?这没有意义。而改变个人格式的偏好也是浪费时间。 – 2013-04-26 09:04:32

回答

1
+0

谢谢!但林与.setProgress错误它说:“方法setProgress(INT,INT,布尔)是未定义的类型NotificationCompat.Builder”。并且还使用mBuilder.build()“NotificationCompat.Builder” – belladonna 2013-04-27 02:57:01

+0

类型的方法build()未定义,它是您想要的应用程序的Android版本?你有没有在支持库中添加? – 2013-04-27 08:26:42

相关问题