fill Int Arrays from Bundle by Key - Android android.os

Android examples for android.os:Bundle

Description

fill Int Arrays from Bundle by Key

Demo Code

import android.os.Bundle;

public class Main{

    public static int[][] fillIntArraysFromKey(Bundle bundle, String baseKey) {
        int count = countIndexes(bundle, baseKey);
        int[][] array = new int[count][];
        for (int i = 0; i < array.length; i++)
            array[i] = bundle.getIntArray(baseKey + i);
        return array;
    }//from   w  w w  .j a  va  2s .  c om
    public static int countIndexes(Bundle bundle, String baseKey) {
        int count = 0;
        while (bundle.containsKey(baseKey + count))
            count++;
        return count;
    }

}

Related Tutorials