Ok, so I am trying to get two different String arrays from one activity, through an alarmManager to a BroadcastReceiver (called AlarmReceiver), and so far have been using myIntentName.putExtra() and the relevant .getExtra() on the broadcastReceiver side of things. Here's my relevant code:
In the first activity (this is called and the code gets to the AlarmReceiver):
private void setAlarmManager() {
Intent intent = new Intent(this, AlarmReceiver.class);
//I have already defined askArray and answerArray (they aren't null, but are dynamic
//and exactly how I define them is quite complex so not included here)
intent.putExtra("askArray", askArray);
intent.putExtra("answerArray", answerArray);
PendingIntent sender = PendingIntent.getBroadcast(this, 2, intent, 0);
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
am.setRepeating(AlarmManager.RTC_WAKEUP, 5000, 61000, sender);
}
At the top of the AlarmReceiver(which extends BroadcastReceiver):
String[] askArray = new String[2];
String[] answerArray = new String[2];
In the broadcastReceiver, in the onReceive():
askArray = intent.getExtras().getStringArray("askArray");
answerArray = intent.getExtras().getStringArray("answerArray");
for (int i = 0; i < askArray.length; i++){ //I get a NullPointerException on this line
Log.i("L3R", "AskArray["+i+"]: " + askArray[i]);
}