80,351
社区成员
发帖
与我相关
我的任务
分享
start.setOnClickListener(new StartListener()); //只有StartListener和EscapeListener报错cannot be resolved to be a type
escape.setOnClickListener(new EscapeListener());
forward.setOnClickListener(new ForwardListener());
back.setOnClickListener(new BackListener());
class StartListener implements OnClickListener{
public void onClick(View v) {
Choices choice = new Choices(SHIFTF5);
try {
fromClient.writeObject(choice);
System.out.println("send the start shift + f5");
} catch (IOException e) {
e.printStackTrace();
}
}
}
class EscapeListener implements OnClickListener{
public void onClick(View v) {
Choices choice = new Choices(ESC);
try {
fromClient.writeObject(choice);
System.out.println("send the escape");
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
class ForwardListener implements OnClickListener{
public void onClick(View v) {
Choices choice = new Choices(RIGHT);
try {
fromClient.writeObject(choice);
System.out.println("send the right (the next)");
} catch (IOException e) {
e.printStackTrace();
}
}
}
class BackListener implements OnClickListener{
public void onClick(View v) {
Choices choice = new Choices(LEFT);
try {
fromClient.writeObject(choice);
System.out.println("send the left (the last)");
} catch (IOException e) {
e.printStackTrace();
}
}
}