Skip to main content

Creo que lo que buscas es algo así:

 private String getStringResourceByName(String aString) {
      String packageName = getPackageName();
      int resId = getResources().getIdentifier(aString, "string", packageName);
   
    return getString(resId);
    }

private String getMimapResourceByName(String aString) {
      String packageName = getPackageName();
      int resId = getResources().getIdentifier(aString, "mimap", packageName);
   
    return getString(resId);
    }

Y ahora ya haces el bucle:

for (int i = 900; i < 910; i++) {
        list.add(new Modules(getStringResourceByName("Module"+i"Module" + i), getMimapResourceByName("module"+i"module" + i)));
    }

Creo que lo que buscas es algo así:

 private String getStringResourceByName(String aString) {
      String packageName = getPackageName();
      int resId = getResources().getIdentifier(aString, "string", packageName);
      return getString(resId);
    }

private String getMimapResourceByName(String aString) {
      String packageName = getPackageName();
      int resId = getResources().getIdentifier(aString, "mimap", packageName);
      return getString(resId);
    }

Y ahora ya haces el bucle:

for (int i = 900; i < 910; i++){
        list.add(new Modules(getStringResourceByName("Module"+i), getMimapResourceByName("module"+i)));
    }

Creo que lo que buscas es algo así:

private String getStringResourceByName(String aString) {
    String packageName = getPackageName();
    int resId = getResources().getIdentifier(aString, "string", packageName);
 
    return getString(resId);
}

private String getMimapResourceByName(String aString) {
    String packageName = getPackageName();
    int resId = getResources().getIdentifier(aString, "mimap", packageName);
 
    return getString(resId);
}

Y ahora ya haces el bucle:

for (int i = 900; i < 910; i++) {
    list.add(new Modules(getStringResourceByName("Module" + i), getMimapResourceByName("module" + i)));
}
Origen Enlace

Creo que lo que buscas es algo así:

 private String getStringResourceByName(String aString) {
      String packageName = getPackageName();
      int resId = getResources().getIdentifier(aString, "string", packageName);
      return getString(resId);
    }

private String getMimapResourceByName(String aString) {
      String packageName = getPackageName();
      int resId = getResources().getIdentifier(aString, "mimap", packageName);
      return getString(resId);
    }

Y ahora ya haces el bucle:

for (int i = 900; i < 910; i++){
        list.add(new Modules(getStringResourceByName("Module"+i), getMimapResourceByName("module"+i)));
    }