fill Bundle Ints From Key - Android Android OS

Android examples for Android OS:Bundle Key

Description

fill Bundle Ints From Key

Demo Code


//package com.book2s;
import android.os.Bundle;

public class Main {
    public static int[] fillIntsFromKey(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.getInt(baseKey + i);
        return array;
    }//from  www.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