title: Getting Canvas.drawPaint not supported error while running an android app
body: <p>I'm using <code>canvas</code> in my android code. It is as given below:  </p>
  
  <pre><code>public class RecognitionScoreView extends View {
      private static final float TEXT_SIZE_DIP = 24;
      private List&lt;Recognition&gt; results;
      private final Paint fgPaint;
      private final Paint bgPaint;
  
      private static String TAG = RecognitionScoreView.class.getSimpleName();
  
      public RecognitionScoreView(final Context context, final AttributeSet set) {
          super(context, set);
  
          float textSizePx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, TEXT_SIZE_DIP, getResources().getDisplayMetrics());
          fgPaint = new Paint();
          fgPaint.setTextSize(textSizePx);
  
          bgPaint = new Paint();
          bgPaint.setColor(0xcc4285f4);
      }
  
      public void setResults(final List&lt;Recognition&gt; results) {
          this.results = results;
          Log.i(TAG, "setResults: Results are " + results);
          postInvalidate();
      }
  
      @Override
      public void onDraw(final Canvas canvas) {
          final int x = 10;
          int y = (int) (fgPaint.getTextSize() * 1.5f);
  
          canvas.drawPaint(bgPaint);
  
          if (results != null) {
              for (final Recognition recog : results) {
                  canvas.drawText(recog.getTitle(), x, y, fgPaint);
                  Log.i(TAG, "onDraw: Object is -- " + recog.getTitle());
                  Log.i(TAG, "onDraw: Object location is -- " + recog.getLocation());
                  Log.i(TAG, "onDraw: Object id is -- " + recog.getId());
                  y += fgPaint.getTextSize();
              }
          }
         /* if (results != null) {
              Intent intent = new Intent(context, ResultActivity.class);
              context.this.startActivity(intent);
  
          }*/
      }
  }  
  </code></pre>
  
  <p>When I run my code, I get this error:  </p>
  
  <blockquote>
    <p>Canvas.drawPaint is not supported. (Ignore for this session)   How to
    fix this?</p>
  </blockquote>