How can I send data, using a custom variable type I created, between activities? I have checked and the "putExtra/putExtras" option does not allow me to send my custom made variable, it only allows string/boolean/int/....
Asked
Active
Viewed 472 times
2 Answers
1
Use a Bundle and make your custom variable Serializable.
Bundle bundle = new Bundle();
bundle.putSerializable("key", CustomVariableObject());
intent.putExtras(bundle);

Zach Butler
- 99
- 4
0
you need to serialize your object
intent.putExtra("MyData", data);
getIntent().getSerializableExtra("MyData");
you can see more informations in this post
How to pass an object from one activity to another on Android

Community
- 1
- 1

Rafael Mota
- 127
- 4