read Integer Array List From Parcel - Android android.os

Android examples for android.os:Parcel

Description

read Integer 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<Integer> readIntegerArrayListFromParcel(Parcel in) {
        int size = in.readInt();
        if (size > 0) {
            ArrayList<Integer> vals = new ArrayList<Integer>();
            for (int i = 0; i < size; i++) {
                int val = in.readInt();
                vals.add(val);
            }/*from  w  w  w  . ja  v a2s  .  c  o m*/
            return vals;
        } else {
            return null;
        }
    }
}

Related Tutorials