2013-02-11 101 views

回答

3

你要通過intent在初始化PendingIntent對象。您可以撥打intent對象putExtra(string,string)方法,而不是,像下面

PendingIntent pendingIntent; 
    Intent intent = new Intent(); 
    intent.setClass(mContext,activity2.class); 
    **intent.putExtra("string","string");** // call putExtra with intent 
    pendingIntent = PendingIntent.getActivity(mContext, 0, intent, 0); // here we are passing intent object. you can also call getBR or GetService , but you will always passing intent in the method. 
0

我認爲你需要的意圖從中再創建PendingIntent使用putExtra

0

是的,這是可能的。第一次使用Intent。將Extars值賦予它。 將Intent加入您的PendingIntent。解決方案簡單

希望你明白我的意思。讓我知道。

0

是的,你可以使用意圖和作爲的PendingIntent使用它:

Intent alarmintent = new Intent(getApplicationContext(),Activity2.class); 
    alarmintent.putExtra("title", "Title of our Notification"); 
    alarmintent.putExtra("note", "Description of our Notification"); 
    PendingIntent sender = PendingIntent.getBroadcast(this, ID, alarmintent,PendingIntent.FLAG_UPDATE_CURRENT | Intent.FILL_IN_DATA); 

我用它爲設備設置報警。希望這會幫助你。

1

下面是代碼:使用意圖putextra的PendingIntent ----- 意圖 notificationIntent =新意圖(上下文,AllContacts.class) ; 日曆c = Calendar.getInstance(); (Calendar.YEAR)+「 - 」+(c.get(Calendar.MONTH)+1)+「 - 」+ c.get(Calendar.DAY_OF_MONTH); notificationIntent。 putExtra(「searddob」,sDate); PendingIntent contentIntent = PendingIntent.getActivity(context,0,notificationIntent,0);

相關問題