Thursday, 15 August 2013

use putParcelableArrayList and putInt on the same bundle passed in intent

use putParcelableArrayList and putInt on the same bundle passed in intent

this error is driving me mad
this is the code to pass the parameters:
Intent intent = new Intent(this, TheClass.class);
Bundle bundle = new Bundle();
bundle.putInt("int_value",1);
bundle.putParcelableArrayList("USER_ARR",arr);
intent.putExtras(bundle);
startActivity(intent);
arr is ArrayList and User is parcellable
the other side is:
Bundle bundle = this.getIntent().getExtras();
ArrayList<User> users = bundle.getParcelableArrayList("USER_ARR");
int int_value = bundle.getInt("int_value");
I also tried following this link: Problems passing integer and
serializable on bundle and do it without bundles, but still can't get it
to work the integer is not passed, unless it is passed without the
paracellable array list

No comments:

Post a Comment