1
嗨我寫了這段代碼,我不明白爲什麼給我syntax error on token "}", delet this token
?爲什麼我得到語法錯誤?
private class DemoView extends View{
public DemoView(Context context) {
super(context);
// TODO Auto-generated constructor stub
}//here***
final int x = 0;
final int y = 0;
this.setOnTouchListener(new View.OnTouchListener(){
public boolean onTouch(View v, MotionEvent e){
switch(e.getAction()){
case MotionEvent.ACTION_DOWN:
x++;
break;
case MotionEvent.ACTION_MOVE: // touch drag with the ball
// move the balls the same as the finger
x = x-25;
y = y-25;
break;
}
return true;
}//here***
}
感謝
編輯代碼以使用字段代替'MoveData'類型的自動變量。 – 2011-02-27 21:28:05