在这种方法中,我将模式设置为 1;
bTouch.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
mode1=1;
Intent startGame = new Intent(
"com.example.mygame.GFXSurface");
startActivity(startGame);
}
});
当我在 onTouch 方法中的其他类中调用该模式时返回 0
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
GameSurface gamesurface = new GameSurface(this);
Mode mode2 = new Mode();
mode= mode2.mode1;
if (mode == 1){ // this should be 1 but is 0
x = event.getX();
y = event.getY();
任何人都知道如何做到这一点的解决方案?