fill Bundle Int Arrays From Key - Android Android OS

Android examples for Android OS:Bundle Key

Description

fill Bundle Int Arrays From Key

Demo Code


//package com.book2s;
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  ww .  j  av  a2 s . c o  m*/

    public static int countIndexes(Bundle bundle, String baseKey) {
        int count = 0;
        while (bundle.containsKey(baseKey + count))
            count++;
        return count;
    }
}

Related Tutorials