Android - 如何访问onCreateView外的单选按钮?

时间:2016-07-07 14:55:22

标签: android radio-button

我需要访问onCreateView()

之外的单选按钮
public void loadArray(String arrayName, Context mContext) {
    SharedPreferences prefs = mContext.getSharedPreferences("preferencename", 0);
    int size = prefs.getInt(arrayName + "_size", 0);
    int array[] = new int[size];

    for(int i=0;i<size;i++) {
        array[i] = prefs.getInt(arrayName + "_" + i, 0);
    }

    for(int i=0; i<size; i++) {
        RadioButton radio1 = (RadioButton) findViewById(array[i]);
    }
}

当然findViewById()onCreateView()内未得到解决,我可以很轻松地rootView.findViewById()

0 个答案:

没有答案