Thursday 15 August 2013

android - String array with drawable values to int array -


I am creating an Andorid application. I have this string array that contains values ​​of image files:

  string [] stringArray = new string [] {"R.drawable.image1", "R.drawable.image2", "R.drawable.image3", "R.drawable.image4"};  

Is it possible to convert string arrays into something like this, if so, can the H Android app read the resource values ​​properly? If yes then how?

  int [] intArray = new int [] {R.drawable.image1, R.drawable.image2, R.drawable.image3, R.drawable.image4};  

If you know the resource type, you can get the identifier. It may be that just hit the string and get the type, then call one of the following methods:


No comments:

Post a Comment