@Test public void getStringArray() throws Exception { String[] array = resources.getStringArray(R.array.arrayName); Assert.assertEquals("item0", array[0]); Assert.assertEquals("item1", array[1]); }
@NonNull public String[] getStringArray(@ArrayRes int id) throws NotFoundException { Map<Integer, String> idNameMap = getIdTable(R_ARRAY); Map<String, List<String>> stringArrayMap = getResourceStringArrayMap(); if (idNameMap.containsKey(id)) { String name = idNameMap.get(id); if (stringArrayMap.containsKey(name)) { List<String> stringList = stringArrayMap.get(name); return stringList.toArray(new String[0]); } } throw new Resources.NotFoundException("String array resource ID #0x" + Integer.toHexString(id)); }
ShadowResources { @NonNull public String[] getStringArray(@ArrayRes int id) throws NotFoundException { Map<Integer, String> idNameMap = getIdTable(R_ARRAY); Map<String, List<String>> stringArrayMap = getResourceStringArrayMap(); if (idNameMap.containsKey(id)) { String name = idNameMap.get(id); if (stringArrayMap.containsKey(name)) { List<String> stringList = stringArrayMap.get(name); return stringList.toArray(new String[0]); } } throw new Resources.NotFoundException("String array resource ID #0x" + Integer.toHexString(id)); } }
ShadowResources { @NonNull public String[] getStringArray(@ArrayRes int id) throws NotFoundException { Map<Integer, String> idNameMap = getIdTable(R_ARRAY); Map<String, List<String>> stringArrayMap = getResourceStringArrayMap(); if (idNameMap.containsKey(id)) { String name = idNameMap.get(id); if (stringArrayMap.containsKey(name)) { List<String> stringList = stringArrayMap.get(name); return stringList.toArray(new String[0]); } } throw new Resources.NotFoundException("String array resource ID #0x" + Integer.toHexString(id)); } ShadowResources(); }
ShadowResources { @NonNull public String[] getStringArray(@ArrayRes int id) throws NotFoundException { Map<Integer, String> idNameMap = getIdTable(R_ARRAY); Map<String, List<String>> stringArrayMap = getResourceStringArrayMap(); if (idNameMap.containsKey(id)) { String name = idNameMap.get(id); if (stringArrayMap.containsKey(name)) { List<String> stringList = stringArrayMap.get(name); return stringList.toArray(new String[0]); } } throw new Resources.NotFoundException("String array resource ID #0x" + Integer.toHexString(id)); } ShadowResources(); int getColor(@ColorRes int id); int getColor(@ColorRes int id, @Nullable Resources.Theme theme); String getString(@StringRes int id); @NonNull String[] getStringArray(@ArrayRes int id); @NonNull int[] getIntArray(@ArrayRes int id); String getPackageName(); }
ShadowResources { @NonNull public String[] getStringArray(@ArrayRes int id) throws NotFoundException { Map<Integer, String> idNameMap = getIdTable(R_ARRAY); Map<String, List<String>> stringArrayMap = getResourceStringArrayMap(); if (idNameMap.containsKey(id)) { String name = idNameMap.get(id); if (stringArrayMap.containsKey(name)) { List<String> stringList = stringArrayMap.get(name); return stringList.toArray(new String[0]); } } throw new Resources.NotFoundException("String array resource ID #0x" + Integer.toHexString(id)); } ShadowResources(); int getColor(@ColorRes int id); int getColor(@ColorRes int id, @Nullable Resources.Theme theme); String getString(@StringRes int id); @NonNull String[] getStringArray(@ArrayRes int id); @NonNull int[] getIntArray(@ArrayRes int id); String getPackageName();  }