using Canvas in android
<p>I am trying to use Canvas that has been created in external class.
However, the app does not run. Here is my code for MyImge where activity starts</p>

<pre><code>import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.ImageView;


public class MyImage2 extends Activity  {
    DemoView draw; 
    private int     imageSizeX = 2047;
    private int     imageSizeY = 2047;
    private int     current_drawable = R.drawable.image;



   @Override
   public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);

  Map&lt;String, Integer&gt; map = new HashMap&lt;String, Integer&gt;();
  map.put("blah", current_drawable);

  ImageView img=(ImageView)findViewById(R.id.imageView); 

  Bitmap bmp=BitmapFactory.decodeResource(getResources() ,current_drawable);
  draw = (DemoView)findViewById(R.id.demo);

  imageSizeX  = bmp.getWidth()/2;
  imageSizeY = bmp.getHeight()/2; 
  Bitmap resizedbitmap=Bitmap.createScaledBitmap(bmp, imageSizeX, imageSizeY, true); 
  img.setImageBitmap(resizedbitmap);     


  }
}
</code></pre>

<p>and my DemoView as follows</p>

<pre><code>import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;

import android.view.View;

public class DemoView extends View{
    public DemoView(Context context){
        super(context);
    }

    @Override protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);


        Paint paint = new Paint();
        paint.setStyle(Paint.Style.FILL);

        // make the entire canvas white
        paint.setColor(Color.WHITE);
        canvas.drawPaint(paint);

        paint.setAntiAlias(false);
        paint.setColor(Color.GREEN);
        canvas.drawRect(100, 5, 200, 30, paint);
        canvas.drawLine(0, 300 , 320, 300, paint);

    }
}
</code></pre>

<p>the layout</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    &gt;
       &lt;ImageView
        android:id="@+id/imageView"
         android:layout_width="fill_parent"       
         android:scaleType="matrix"         
        android:layout_height="525px"&gt;
   &lt;/ImageView&gt;

    &lt;view class="com.test.DemoView"
     android:id="@+id/demo"
        android:layout_width="fill_parent"
        android:layout_height="125px"/&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>if I remove the tag com.myimage2.DemoView I can see the image, however my goal is to see the image and canvas. Could someone help please.</p>

<p>Error log:</p>

<pre><code>!ENTRY com.android.ide.eclipse.adt 2 0 2011-04-10 02:19:27.204 
!MESSAGE AndroidManifest: Ignoring unknown 'com.test.DemoView' XML element 
!ENTRY com.android.ide.eclipse.adt 2 0 2011-04-10 02:19:27.891 
!MESSAGE AndroidManifest: Ignoring unknown 'view' XML element
</code></pre>

<p>Many thanks in advance.</p>
