shape draw in imageview
<p>I am trying to follow </p>

<p><a href="http://developer.android.com/guide/topics/graphics/2d-graphics.html" rel="nofollow">http://developer.android.com/guide/topics/graphics/2d-graphics.html</a></p>

<p>and draw a shape on top of the imageview</p>

<p>my class is </p>

<pre><code>package com.bayer.glucofacts;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.widget.ImageView;

public class CustomDrawableImageView extends ImageView {
 private ShapeDrawable mDrawable;

 public CustomDrawableImageView(Context context) {
  super(context);
  int x = 10;
  int y = 100;
  int width = 300;
  int height = 50;
  mDrawable = new ShapeDrawable(new OvalShape());
  mDrawable.getPaint().setColor(0xff74AC23);
  mDrawable.setBounds(x, y, x + width, y + height);
 }

 protected void onDraw(Canvas canvas) {
  mDrawable.draw(canvas);
 }
}
</code></pre>

<p>and did xl like</p>

<pre><code>&lt;com.cmp.app.CustomDrawableImageView
  android:id="@+id/bg_image" android:src="@drawable/book"
  android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt;
</code></pre>

<p>but this crashes my app when i doo setContnetLayout in onCreate of the activity</p>

<p>when i was doing only ImageView without extending it for canvas drawing, it was working fine.</p>

<p>whats the problem ? </p>

<p>basically i plan to draw an image and a few lines on top of the image. how to do this ?</p>
