Gopika Perumalla
Gopika Perumalla

Reputation: 109

How to write and read ArrayList<String> to parcel in android

In my project, I have to write and read ArrayList<String> to parcel, I tried with writeList and writeStringList but no use, I am getting exceptions while reading the lists.

Could any one help me in this?

Thanks In advance.

Upvotes: 7

Views: 7298

Answers (2)

Oleksandr Bodashko
Oleksandr Bodashko

Reputation: 131

use this to write:

bundle.putStringArrayList(KEY, stringArrayList); 

and this to read:

ArrayList<String> stringArrayList = bundle.getStringArrayList(KEY);

Upvotes: 1

StoneBird
StoneBird

Reputation: 1940

By @JeremyRoman: writeStringList, readStringList and createStringArrayList all exist on Parcel since API 1.

Upvotes: 8

Related Questions