read String Array List From Parcel - Android android.os

Android examples for android.os:Parcel

Description

read String Array List From Parcel

Demo Code


//package com.java2s;
import android.os.Parcel;
import java.util.ArrayList;
import java.util.List;

public class Main {
    public static List<String> readStringArrayListFromParcel(Parcel in) {
        int size = in.readInt();
        if (size > 0) {
            ArrayList<String> vals = new ArrayList<String>();
            for (int i = 0; i < size; i++) {
                String val = in.readString();
                vals.add(val);
            }//ww w.jav a2 s . c om
            return vals;
        } else {
            return null;
        }
    }
}

Related Tutorials