title: R cannot be resolved to a variable
body: <p>I got all of this code from <a href="http://developer.android.com/resources/samples/SoftKeyboard/index.html" rel="nofollow">here</a></p>
  
  <p>I am extremely new to all of this, and am having a few problems.</p>
  
  <p>The error "R cannot be resolved to a variable" comes up on the bold parts of this code. </p>
  
  <pre><code>    Resources r = context.getResources();
  
      **setBackgroundColor(r.getColor(R.color.candidate_background));
  
      mColorNormal = r.getColor(R.color.candidate_normal);
      mColorRecommended = r.getColor(R.color.candidate_recommended);
      mColorOther = r.getColor(R.color.candidate_other);
      mVerticalPadding = r.getDimensionPixelSize(R.dimen.candidate_vertical_padding);**
  
      mPaint = new Paint();
      mPaint.setColor(mColorNormal);
      mPaint.setAntiAlias(true);
      **mPaint.setTextSize(r.getDimensionPixelSize(R.dimen.candidate_font_height));**
      mPaint.setStrokeWidth(0);
  </code></pre>
  
  <p>The only thing I can think of is that I haven't copied and pasted everything correctly?</p>