Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.support.v4.util.ArrayMap;
import android.view.View;

import android.widget.RadioButton;
import android.widget.RadioGroup;

public class Main {
    public static ArrayMap<Integer, RadioButton> getRadioButtonsMap(RadioGroup radioGroup) {
        final ArrayMap<Integer, RadioButton> out = new ArrayMap<>(radioGroup.getChildCount());
        for (int i = 0; i < radioGroup.getChildCount(); i++) {
            final View v = radioGroup.getChildAt(i);
            if (v instanceof RadioButton) {
                out.put(v.getId(), (RadioButton) v);
            }
        }
        return out;
    }
}