Code example for SurfaceView

Methods: getHolder, setFocusable, setOnTouchListener

0
         
        // view.setGameView(this); 
         
    	Log.w("ActView", "constructor");
 
        view.setOnTouchListener(this);
 
        // register our interest in hearing about changes to our surface 
        SurfaceHolder holder = view.getHolder();
        holder.addCallback(this);
 
        // mContext= context; 
 
        view.setFocusable(true); // make sure we get key events
    } 
 
     
    public void setGameRuntime( GameRuntime gameRuntime ) {
    	mGameRuntime= gameRuntime;
    	mGameRuntime.init(view.getContext());
	}