title: Unable to set an image to imageView through string in android
body: <p>I have a set of image names in my XML file (tutor.xml).<br>
  I am trying to parse it and get my image names and set to the <strong>ImageView</strong> here in my activity.<br>
  It gives datatype error (Not applicable for image) it must be an integer. </p>
  
  <pre><code>try {
      getAlphabet = getFromXML(MainActivity.this);
      } catch (XmlPullParserException e) {
      e.printStackTrace();
      } catch (IOException e) {
      e.printStackTrace();
  }
          String[] str = getAlphabet.split("\n");
          int lenAcAlp = str.length;
      String[] textFileLink = new String[lenAcAlp];
      String res = "R.drawable.";
      int key=0;
      while(key&lt;lenAcAlp){
          textFileLink[key] = res + str[key];
      }
      ImageView iv = (ImageView)findViewById(R.id.imageView1);
      for(int i=0;i&lt;lenAcAlp;i++){
          iv.setImageResource(textFileLink[i]);
      }
      }
  
  private String getFromXML(MainActivity mainActivity)throws XmlPullParserException, IOException {
      StringBuffer stringBuffer = new StringBuffer();
          Resources res = mainActivity.getResources();
      XmlResourceParser xpp = res.getXml(R.xml.tutor);
      xpp.next();
      int eventType = xpp.getEventType();
      while(eventType != XmlPullParser.END_DOCUMENT){
          if(eventType == XmlPullParser.START_TAG){
              if(xpp.getName().equals("tutorappdata")){
              stringBuffer.append(xpp.getAttributeValue(null, "keyitem") +"\n");              }   
          }
          eventType = xpp.next(); 
      }
      return stringBuffer.toString();
      }
  </code></pre>
  
  <p>Please help me: how should I set my images to the <strong>ImageView</strong> iv, if not through string how shall set my images.<br>
  Thanks</p>