I'm sure I've missed something stupid, this can't be this hard...
I'm passing an arraylist of integers from one class to another. Logs show the data is correct in the passing class, but it invariably shows up null in the recieving class. All other intent data is correctly passed.
ArrayList unsavedEditedSets are private class variables.
Please help.
Passing Class segment:
holder.returnButton.setOnClickListener(new OnClickListener() {
public void onClick(View v)
{
unsavedEditedSets.add(setPositionChoice);
Intent i = new Intent(SetEditor.this, DisplayFullWorkout.class);
i.putIntegerArrayListExtra("use", unsavedEditedSets);
Log.d("INIT - OK",""+unsavedEditedSets); // This shows data is in the arraylist
i.putExtra("subsets", subsetsList);
i.putExtras(extras);
startActivity(i);
}
});
Catching Class:
private ArrayList<Integer> unsavedEditedSets;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.display_full_workout);
Intent incomingI = getIntent();
subsetsList = (ArrayList<HashMap<String, String>>)incomingI.getSerializableExtra("subsets");
unsavedEditedSets = (ArrayList<Integer>) incomingI.getIntegerArrayListExtra("use");
extras = incomingI.getExtras();
Log.d("Incoming - BAD",""+unsavedEditedSets); // This shows null arraylist
}
Tried using a new arraylist right before sending and still get null:
ArrayList<Integer> test = new ArrayList<Integer>();
test.add(12);
test.add(19);
i.putExtra("use", test); Log.d("INIT - OK",""+test);
unsavedEditedSetsfrom the catching class?putExtrasandputExtra("subsets"...)? Doesextrascontain"use"by chance?