它是否可以使用putExtra方法的PendingIntent方法putExtra(字符串,字符串)是未定義的類型的PendingIntent
1
A
回答
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);
相關問題
- 1. 方法setLatestEventInfo(爲myService,字符串,字符串,的PendingIntent)是未定義的類型通知
- 2. Jsoup方法的標題(字符串,字符串)是未定義的類型Connection.KeyVal
- 3. 該方法的setAttribute(字符串,字符串)是未定義的類型WebElement
- 4. 方法getString(字符串)是未定義的類型字符串在Android中
- 5. 該方法的getConnection(字符串,字符串,字符串)是未定義的類型的DriverManager
- 6. 方法getJSONObject(字符串)是未定義的類型的JSONObject
- 7. 方法桶(字符串)是未定義的類型SubmissionRepositoryImpl
- 8. Android Ksoap2:方法setName(字符串)是未定義的類型PropertyInfo
- 9. 方法setText字符串是未定義的類型視圖
- 10. 方法添加(字符串)是未定義類型JSONArray
- 11. 字符串是未定義
- 12. 的java - 如何修復的方法setLatestEventInfo(AlarmService_Service,字符串,CharSequences,的PendingIntent)是未定義的類型通知
- 13. 字符串未定義方法`^'(NoMethodError)
- 14. 方法addHandler(字符串,服務器)未定義類型WebServer
- 15. 未定義的字符串
- 16. 方法parseJson(字符串)是未定義的類型的Util - 實SDK錯誤
- 17. Operator ||是未定義的參數類型布爾值,字符串
- 18. 運算符*未定義的參數類型字符串,整數
- 19. Rails:未定義的方法`primary_key'爲字符串:類
- 20. fieldQuery(字符串,字符串)是未定義
- 21. 定義自定義字符串方法
- 22. 打印圍棋類型忽略「字符串()字符串」方法
- 23. 方法scrollto(字符串)是未定義的webdriver
- 24. 未定義jQuery字符串
- 25. 定義:AnsiString類型,WideString的,字符串的char [],字符*,BSTR,
- 26. Android - 方法我(字符串,字符串)是不明確的類型日誌
- 27. 該方法isDefined(char)是未定義的類型字符
- 28. d3js - 類型錯誤:字符串是未定義
- 29. 方法managedQuery(URI,字符串[],字符串,字符串[],字符串)從類型活動已被棄用
- 30. 字符串自定義類型替換