请问一下,这里为什么会出现cannot be resolved to a type的情况?

arThurwan 2013-07-06 01:22:36
        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();
}
}
}


只有StartListener和EscapeListener报错cannot be resolved to be a type,但是另外两个却没有问题?不知道原因,想问大家。
谢谢啦
...全文
449 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhx00100 2013-07-06
  • 打赏
  • 举报
回复
而且, 你贴的是源码吗? 该有大括号的地方没有, 函数调用 和 类定义 在一个{}里?
zhx00100 2013-07-06
  • 打赏
  • 举报
回复
未必另外两个没问题。 只保留第一个:start.setOnClickListener(new StartListener()); 其他3个删了, 看看

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧