开发者

android parcelable string array

I have

ArrayList<String> ids = ArrayLi开发者_如何学运维st<String>();

What would be the cleanest way to make it Parceleable? Apparently String itself is not parcelable, so Parcel.writeList(ids) is not working.

I was thinking to either parcelize ArrayList<Uri> or put array contents into a Bundle.


Convert your list to String[] and use Parcel.writeStringArray. Example here


This isnt parcelizing, but to put it in a bundle:

ArrayList<String> ids = new ArrayList<String>();
savedInstanceState.putStringArrayList("key",ids);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜