title: how to link the class shown below with main activity
body: <p>here is the code of the class which i created which extends MainActivity and how can i call this from MainActivity?
  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.  Here is my main class:</p>
  
  <pre><code>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 ball;
       float x,y;
  
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          v=new OurView(this);
          v.setOnTouchListener(this);
        ball=BitmapFactory.decodeResource(getResources(),R.drawable.tennis_ball);
          x = y = 0;
          setContentView(v);
      }
  
      protected void onResume() {
          // TODO Auto-generated method stub
          super.onResume();
          v.resume();
      }
      public class OurView extends SurfaceView implements Runnable{
        Thread t;
  
        SurfaceHolder holder;
  
        boolean isItOk=false;
  
    public OurView(Context context) {
          super(context);
          // TODO Auto-generated constructor stub
          holder=getHolder();
      }
  
  
      public void run() {
  
          // TODO Auto-generated method stub
  
          while( isItOk ==true)
          {
           //drawing   
           if(holder.getSurface().isValid()) {
  
              continue;
  
           }
  
       Canvas c=holder.lockCanvas();
           c.drawARGB(255,150,150,10);    
           c.drawBitmap(ball, x+(ball.getWidth()/4), y+(ball.getHeight()), null);
  
           holder.unlockCanvasAndPost(c);     
  
          }
       }
      public void pause()
      {
          isItOk=false;
          while(true) {
              try {
                  t.join();
              }catch(InterruptedException e) {
  
                  e.printStackTrace();
  
              }
              break;
  
          }
      }
  
      public void resume()
      {
         isItOk=true;  
         t=new Thread(this);
         t.start();
      }
  
       }
       public boolean onTouch(View v, MotionEvent event) {
      // TODO Auto-generated method stub
      return false;
        } 
  
  
  
  
    } 
  </code></pre>