Cannot resolve symbol 'OnClickListener'
时间: 2023-07-26 16:30:05 浏览: 49
抱歉,这是我在上一条回答中犯的错误。正确的写法是 `View.OnClickListener`。也就是说,你需要将原来的代码中的 `OnClickListener` 替换为 `View.OnClickListener`,如下所示:
```
// 保存原始的点击事件
View.OnClickListener originalListener = btn_fill_start.getOnClickListener();
// 跳转到其他页面
Intent intent = new Intent(XbyActivity.this, But_Noth_Record.class);
startActivity(intent);
// 在返回时恢复原始的点击事件
btn_fill_start.setOnClickListener(originalListener);
```
请注意,如果你的代码中没有导入 `View.OnClickListener`,你需要在开头加上这个语句:
```
import android.view.View;
```
这样就可以解决这个问题了。
相关推荐
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pptx](https://img-home.csdnimg.cn/images/20210720083543.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)