是否可以在Receiver类或Activity Class中获取requestCode? p>
这是我未决的意图
alarmMgr= (AlarmManager)getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(this, BroadcastReceiver_Class.class);
/*intent.putExtra("alarm_time_minutes", minutes);*/
pendingIntent = PendingIntent.getBroadcast(this, requestCode, intent,requestCode);
alarmMgr.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pendingIntent);
先谢谢..
答案 0 :(得分:9)
您可以将requestCode
作为额外的意图。如下:
intent.putExtra("requestCode", requestCode);
然后你可以通过以下方式在Activity类中获取它:
int requestCode = received_intent.getExtras().getInt("requestCode");