Conversion of resource-massistant into the dynamics of ArrayList



  • How to convert resources into dynamics ArrayList?

    <string-array name="name">
            <item>0</item>
            <item>3</item>
            <item>4</item>
            <item>5</item>
        </string-array>
    


  • According to the https://stackoverflow.com/a/157950/3212712 on the first line of handing over the Google upon request

    https://www.google.ru/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=array%20to%20arraylist%20java

    There is a statistical method for this purpose. asList Class Arraysaccepting a mass of something as an argument. The result of the challenge of this method should be transmitted to the designer ArrayList♪ I mean, in your case, it's like,

    String[] arrayFromRes = getResources().getStringArray(R.array.name);
    ArrayList<String> arrayListFromStringArrayFromResources = new ArrayList<String>(Arrays.asList(arrayFromRes));
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2