where did i go wrong with surface view
<p>I'm trying to figure out where I went wrong on referencing my surface view class, not my view. I only did the view as an example. </p>

<p>Here is my main class:</p>

<pre><code> package com.example;

    import android.app.Activity;
    import android.os.Bundle;


    public class AnimationActivity extends Activity {
    /** Called when the activity is first created. */
    Drwwingtheball v;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            // TODO Auto-generated method stub
            super.onCreate(savedInstanceState);
                v = new Drwwingtheball(this);
                setContentView(v);
    }

    }
</code></pre>

<p>Here is my view class:</p>

<pre><code>package com.example;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.View;

public class Drwwingtheball extends View{

Bitmap bball;
int x, y;
public Drwwingtheball(Context context) {
    super(context);
    bball = BitmapFactory.decodeResource(getResources(), R.drawable.newbball);
    x=0;
    y=0;
}

@Override
protected void onDraw(Canvas canvas) {
    // TODO Auto-generated method stub
    super.onDraw(canvas);

    Rect ourrect = new Rect();
    ourrect.set(0, 0, canvas.getWidth(), canvas.getHeight()/2);
    Paint blue = new Paint();
    Paint green = new Paint();
    blue.setColor(Color.BLUE);
    blue.setStyle(Paint.Style.FILL);
    green.setColor(Color.GREEN);
    if (x &lt; canvas.getWidth()){
        x+=12;

    }else{
        x=0;
    }
    if (y &lt; canvas.getHeight())
    {
        y +=8;

    }else{
    y=0;    
}
    canvas.drawBitmap(bball, x , y, new Paint(green));
    invalidate();

    }
}
</code></pre>

<p>Here is my surface view Class:</p>

<pre><code>package com.example;

 import android.app.Activity;
 import android.content.Context;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.graphics.Canvas;
 import android.os.Bundle;
 import android.view.MotionEvent;
 import android.view.SurfaceHolder;
 import android.view.SurfaceView;
 import android.view.View;
 import android.view.View.OnTouchListener;

 public class surfaceviewexample extends Activity implements OnTouchListener{
    ourView v;
    Bitmap bball;
    float x, y;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        v = new ourView(this);
        v.setOnTouchListener(this);
        bball = BitmapFactory.decodeResource(getResources(), R.drawable.bball);

        setContentView(v);
    }
    @Override
    protected void onPause() {
        // TODO Auto-generated method stub
        super.onPause();
        v.pause();
    }
    @Override
    protected void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
        v.resume();
    }
    public class ourView extends SurfaceView implements Runnable{
        Thread t=null;
        SurfaceHolder holder;
        boolean isitok=false;

        public ourView(Context context) {
            super(context);
            holder = getHolder();
        }
        public void run(){
            while(isitok == true){
                if(!holder.getSurface().isValid()){
                    continue;
                }   
                Canvas c= holder.lockCanvas();
                c.drawARGB(255, 150, 155, 25);
        c.drawBitmap(bball, x-bball.getWidth()/2, y=bball.getHeight()/2, null);
                holder.unlockCanvasAndPost(c);
            }
        }
        public void pause(){
            isitok=false;
            while(true){
                try{
                    t.join();
                }catch( InterruptedException e){
                    e.printStackTrace();
                }
                break;
            }
            t = null;
        }
        public void resume(){
            isitok=true;
            t = new Thread(this);
            t.start();
        }
 }
    @Override
    public boolean onTouch(View v, MotionEvent me) {
        // TODO Auto-generated method stub
        x = me.getX();
        y = me.getY();

        switch(me.getAction()){
        case MotionEvent.ACTION_DOWN:
            x = me.getX();
            y = me.getY();
            break;
        case MotionEvent.ACTION_UP:
            x = me.getX();
            y = me.getY();
            break;
        case MotionEvent.ACTION_MOVE:
            x = me.getX();
            y = me.getY();
            break;
        }

        return true;
    }
 }
</code></pre>

<p>Here is my manifest:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example"
      android:versionCode="1"
      android:versionName="1.0"&gt;
    &lt;uses-sdk android:minSdkVersion="7" /&gt;

    &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
        &lt;activity android:name=".AnimationActivity"
                  android:label="@string/app_name"&gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.MAIN" /&gt;
                &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
    &lt;/application&gt;
&lt;/manifest&gt;
</code></pre>
