Reputation: 2362
In Activity
I have used the following code for passing the value to other Activity classes:
intent.putExtra("book_arr", book_arr); // [putExtra(String *name*,Serializable *Value*)]
How to use like this code in Android Fragments?
I have tried the following code, but it is not supporting serialized value:
Bundle args =new Bundle();
args.putInt("book_arr", book_arr);
Thanks,
Upvotes: 4
Views: 2515
Reputation: 431
args.putSerializable("book_arr", book_arr);
If your book_arr
(which should be bookArr
) is a large array of heavy objects, consider making them Parcelable. You'll need to write additional code, but it's about x10 faster. (if it's not a big object you probably shouldn't bother). This page can be helpful
http://www.developerphil.com/parcelable-vs-serializable/
Upvotes: 1