Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;
import android.content.res.TypedArray;

public class Main {
    public static int[] getIdArray(Context context, int arrayId) {
        TypedArray typedArray = context.getResources().obtainTypedArray(arrayId);
        int length = typedArray.length();
        int[] ids = new int[length];
        for (int i = 0; i < length; i++) {
            ids[i] = typedArray.getResourceId(i, -1);
        }
        typedArray.recycle();
        return ids;
    }
}