2012-04-18 29 views
2

我面臨一些待處理意圖的問題。我使用通知管理器設置了一些待定內容。這些通知在用戶點擊它們時啓動一項活動。我在待決意圖中使用了Intent。這可以通知點擊確定。Android:如何從其他活動推出待定意圖?

Notification notification = new Notification(icon, tickerText, when); 
    Context context = getApplicationContext(); 

Intent intentOptionDialog = new Intent(Safety_Check_Service.this, Dialog_Safety_Check.class); 
    intentOptionDialog.putExtra("startID",startId); 
    intentOptionDialog.putExtra("CheckInID", CheckInId); 
    intentOptionDialog.putExtra("Frequency", Frequency); 
    intentOptionDialog.putExtra("flagFirstShedule", true); 

     stopID = (startId + 17); 

    intentOptionDialog.putExtra("stopID", stopID); 

    PendingIntent contentIntent = PendingIntent.getActivity(Safety_Check_Service.this, DIALOG_ID, intentOptionDialog, 0); 

但我的問題是,我想從其他活動啓動這些掛起的意圖。等待的意圖被創建。我如何能從其他活動中獲得這些未決意圖,以及如何獲得設置有未決意圖的附加功能?

請幫幫我。

+0

看到這篇文章http://iserveandroid.blogspot.com/2011/03/how-to-launch-pending-intent.html – 2012-04-18 05:16:56

+0

我見過這個。但我沒有服務意圖的對象,我不能訪問它。我必須創造一個新的。 – 2012-04-18 05:57:15

回答

2

我認爲你有2個位置:

  1. 嘗試使用我在Keeping track of sms sent in Android答曰:當您創建PendingActivity,迫使它與它攜帶額外添加FILL_IN_SELECTOR標誌。
  2. 一旦你有PendingIntent,你可以調用send方法來觸發它。
相關問題