그냥 책에 있는거 따라 햇는데 잘 이해가 안가네요...
알아볼수 있도록 색칠한 부분만 주석만 달아주시면 안되나요...ㅜ
항상 기본적으로 따라오는 소스 같은데 잘이해가 .;;

package exam.MoveCircle;

import android.app.*;
import android.content.*;
import android.graphics.*;
import android.os.*;
import android.view.*;

public class MoveCircle extends Activity{
 private MyView vw;
 
 public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  vw = new MyView(this);
  vw.setFocusable(true);
  vw.setFocusableInTouchMode(true);
  setContentView(vw);
 }
 protected class MyView extends View{
  float mX,mY;
  int mColor;
  public MyView(Context context){
   super(context);
   mX=100;
   mY=100;
   mColor=Color.BLUE;
  }
  public void onDraw(Canvas canvas){
   Paint pnt = new Paint();
   canvas.drawColor(0xffe0e0e0);
   pnt.setColor(mColor);
   pnt.setAntiAlias(true);
   canvas.drawCircle(mX,mY,16,pnt);
  }
  
  public boolean onKeyDown(int KeyCode, KeyEvent event){
   super.onKeyDown(KeyCode, event);
   if(event.getAction()==KeyEvent.ACTION_DOWN){
    switch(KeyCode){
    case KeyEvent.KEYCODE_DPAD_LEFT:
     mX-=5;
     invalidate();
     return true;
    case KeyEvent.KEYCODE_DPAD_RIGHT:
     mX+=5;
     invalidate();
     return true;
    case KeyEvent.KEYCODE_DPAD_UP:
     mY-=5;
     invalidate();
     return true;
    case KeyEvent.KEYCODE_DPAD_DOWN:
     mY+=5;
     invalidate();
     return true;
    case KeyEvent.KEYCODE_DPAD_CENTER:
     if(mColor==Color.BLUE){
      mColor=Color.RED;
     }else{
      mColor=Color.BLUE;
     }invalidate();
     return true;
     }
    }
   return false;
  }
 }
}