title: Get resource image by name into custom cursor adapter
body: <p>I have a custom cursor adapter and I'd like to put an image into a ImageView in a ListView.</p>
  
  <p>My code is:</p>
  
  <pre><code>public class CustomImageListAdapter extends CursorAdapter {
  
    private LayoutInflater inflater;
  
    public CustomImageListAdapter(Context context, Cursor cursor) {
      super(context, cursor);
      inflater = LayoutInflater.from(context);
    }
  
    @Override
    public void bindView(View view, Context context, Cursor cursor) {
      // get the ImageView Resource
      ImageView fieldImage = (ImageView) view.findViewById(R.id.fieldImage);
      // set the image for the ImageView
      flagImage.setImageResource(R.drawable.imageName);
      }
  
    @Override
    public View newView(Context context, Cursor cursor, ViewGroup parent) {
      return inflater.inflate(R.layout.row_images, parent, false);
    }
  }
  </code></pre>
  
  <p>This is all OK but I would like to get the name of image from database (cursor).
  I tried with </p>
  
  <pre><code>String mDrawableName = "myImageName";
  int resID = getResources().getIdentifier(mDrawableName , "drawable", getPackageName());
  </code></pre>
  
  <p>But return error: "The method getResources() is undefined for the type CustomImageListAdapter"</p>