0
因此,我正在嘗試使用NotificationHelper
來通知用戶下載的進度。可能創建兩個NotificationHelper實例?
public class MapDownload extends AsyncTask<String, Integer, String>{
public MapDownload(ArrayList<PlaceDetails> placeList, int travelogueID, Context mContext, String travelogueName){
this.places = placeList;
this.zoom = 12;
this.tID = travelogueID;
mNotificationHelper = new NotificationHelper(mContext, travelogueName);
}
@Override
protected void onPreExecute(){
//Create the notification in the statusbar
mNotificationHelper.createNotification();
}
}
不過,我想知道是否有可能實現它這樣的,如果我發動另一MapDownload
類下載的東西,我怎麼能做到這一點,從而將兩者同時運行的?看來第二個MapDownload
發射時,第一個消失,而第二個消息將替換先前的通知。
這是一個錯誤的AsyncTask
執行的問題,或錯誤的使用方法NotificationHelper
?
嗯,我不確定,我按照從這裏的指南:http://eliasbland.wordpress.com/2011/03/11/an-example-of-how-to-run-a-background-task -and-report-progress-in-the-status-bar-using-asynctask-on-android /#comment-285 ... NotificationManager會是一個更簡單的解決方案嗎? – lyk 2013-02-11 14:23:23
好的,我看到你來自哪裏,關於ID! – lyk 2013-02-11 14:24:56
您可以使用Google兼容庫提供的'NotificationCompat.Builder'。這很容易使用:[創建一個簡單的通知](http://developer.android.com/guide/topics/ui/notifiers/notifications.html#SimpleNotification) – nicopico 2013-02-11 14:43:47