how to bundle array of File objects or array of Json objects or array of user-defined objects in one activity and send it to another and how to access them correctly. ?
Primitive types like string is quite easy with
Intent in = new Intent(); Bundle bundle = new Bundle(); bundle.putString("name", "test"); in.putExtras(bundle); startActivity(in);
Some reading suggested to use Parcelable , some serializable !! What is the right way and how to do it. ?
If you’re using JSON already then it’s plain old text and you don’t need fancy inter-process mechanisms to serialise it.
Personally I’d favour Parcelable over Serializable any day of the week – unless you’re writing to permanent storage – but to be sure I’d need to know a little more about the problem you’re trying to solve…
What is activity 2 going to be doing with the data from activity 1? Will activity 2 be okay using it’s own copy of the data, or would you expect changes it makes to be visible to activity 1?