关于String数组的用法

android ContextWrapper.getResources(ContextWrapper.java:89)

getResources()报错原因是在OnCreate方法外 无法完成Context的初始化

正确做法:

    String[] names;
    names = new  String[6];
    names[0] = getResources().getString(R.string.a);
    names[1] = getResources().getString(R.string.b);
    names[2] = getResources().getString(R.string.c);
    names[3] =  getResources().getString(R.string.d);
    names[4] = getResources().getString(R.string.e);
    names[5] = getResources().getString(R.string.f);
原文地址:https://www.cnblogs.com/yangcong/p/4939918.html