Android, Unable to draw on View based on Touch or MotionEvent in emulator
<p>Im trying to learn Android graphics &amp; event handeling for a multiplayer game. </p>

<p>As a building block Im developing some code that will draw path of points based on touch/motion events, however Im unable to draw, nothing gets drawn on the Emulator</p>

<p>I have 3 simple classes (MyPoint,GameCanvas,Game):</p>

<p>1)  MyPoint class encapsulates x &amp; y positions , draw method draws a point based on those positions</p>

<pre><code>public class MyPoint  {

    private float x; 
    private float y; 
    Paint pWhite = new Paint(R.color.white);

    public MyPoint(float x, float y) {

           this.x = x;
           this.y = y;
    }//end const
    public void draw(Canvas canvas) {
        canvas.drawPoint(this.x, this.y, pWhite);
    }//end method
}//end MyPoint Class
</code></pre>

<p>2) GameCanvas is the View that will be drawn on , this class is responsible for
  its on event handling by implementing OnTouchListener ,onThouch() method</p>

<pre><code>    public class GameCanvas extends View implements OnTouchListener {

        //keep track on points created by touch events
        java.util.List&lt;MyPoint&gt; pointsList = null;

        public GameCanvas(Context context) {
            super(context);
            setFocusable(true);
            setFocusableInTouchMode(true);

            setOnTouchListener(this);
            pointsList = new java.util.Stack();

        }//end const 

//onDraw iterates through points that were added during motion/touch events and calls the MyPoint.draw(canvas) 

        @Override
        protected void onDraw(Canvas canvas) {

            MyPoint p = null;
            for (int i = 0; i &lt; pointsList.size(); i++) {
                p = (MyPoint) pointsList.remove(i);
                p.draw(canvas);
            }

        }//end onDraw

        //implemented in order to handel touch events 
        public boolean onTouch(View arg0, MotionEvent event) {
            int action = event.getAction();
            float currentX = event.getX();
            float currentY = event.getY();

            //log x and y coordinates
            Log.v(this.getClass().getName().toString(), "X=" + currentX);
            //log x and y coordinates
            Log.v(this.getClass().getName().toString(), "Y=" + currentY);

            if (action == MotionEvent.ACTION_DOWN) {

                // log action down 
                Log.v(this.getClass().getName().toString(), "MotionEvent = ACTION_DOWN");

                pointsList.add(new MyPoint(currentX, currentY));
                this.invalidate();
            } else if (action == MotionEvent.ACTION_MOVE) {

                //log action move 
                Log.v(this.getClass().getName().toString(), "MotionEvent = ACTION_MOVE");

                pointsList.add(new MyPoint(currentX, currentY));
                this.invalidate();
            } else if (action == MotionEvent.ACTION_UP) {

                //log action move 
                Log.v(this.getClass().getName().toString(), "MotionEvent = ACTION_UP");

                pointsList.add(new MyPoint(currentX, currentY));
                this.invalidate();
            }
            //call invalidate in order to call trigger onDraw()

            return true;
        }//end onTouch() 
    }//end GameCanvas class
</code></pre>

<p>3) Game class is the Activity launches GameCanvas View</p>

<pre><code>public class Game extends Activity {

GameCanvas newGameCanvas = null;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        //create GameCanvas object 
        newGameCanvas = new GameCanvas(this);
        super.onCreate(savedInstanceState);
        setContentView(newGameCanvas);
        //
        newGameCanvas.requestFocus();

    }//end OnCreate 
}//end Game class
</code></pre>
