title: How to write an array which stores the images from the drawable folder?
body: <p>Can i know what did i do wrong? i just wanna get my images from drawable folder and pass it to my adapter to display on my gridView.. But i dont know how to add inside the array.. The error message is at the line</p>
  
  <pre><code>arrImages[i] = this.getResources().getIdentifier(wd.getName(), "drawable", this.getPackageName());
  </code></pre>
  
  <p>Anybody wants to help me :( I wanna load it dynamically according to the names in my database.. the database name (wd.getName()) is the same as my file name.png</p>
  
  <p>Declare at the top :</p>
  
  <pre><code>    int arrImages [] = {};
  </code></pre>
  
  <p>Inside onCreate :</p>
  
  <pre><code>    int i = 0;
      for (Words wd : words)
      {
  
          String log = "Id: " + wd.getId() + " ,Name: " + wd.getName();
          // Writing Contacts to log
          Log.d("wordList : ", log);
  
          arrImages[i] = this.getResources().getIdentifier(wd.getName(), "drawable", this.getPackageName());
  
          i++;
      }
  </code></pre>