title: dynamic Bitmap drawable in android
body: <p>I am wondering how i can set a Bitmap drawable resource from a dynamic variable that is the image name/ type string:</p>
  
  <pre><code>public CustomIcon getView(int position, View convertView, ViewGroup parent) {
          String label;
          String image;
          DataBaseManager db = new DataBaseManager(context);
          label = db.getIconLabel(mIcons.get(position));
          image = db.getIconImage(mIcons.get(position));
          Bitmap bitmap = BitmapFactory.decodeResource(parent.getResources(),
                  parent.getResources().getIdentifier(image, "drawable", getApplicationContext().getPackageName()));
          Log.v(TAG, "current pos:"+ position);
          CustomIcon icon = new CustomIcon(context, bitmap,label);
  
          return icon;
      }
  </code></pre>
  
  <p><strong>the part in question is</strong> </p>
  
  <pre><code>Bitmap bitmap = BitmapFactory.decodeResource(parent.getResources(),
                           R.drawable.[image]);
  </code></pre>
  
  <p><strong>CODE CHANGED ABOVE</strong> -</p>