首页> 开发问题 >其它问题 其它问题
Unreachable statement
作者:小萝卜 2019-11-29 【 漏洞BUG 】 浏览 1355
简介Unreachable statement
public boolean onQueryTextSubmit(String s) {
if (sv != null) {
// 得到输入管理对象
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
// 这将让键盘在所有的情况下都被隐藏,但是一般我们在点击搜索按钮后,输入法都会乖乖的自动隐藏的。
imm.hideSoftInputFromWindow(sv.getWindowToken(), 0); // 输入法如果是显示状态,那么就隐藏输入法
}
sv.clearFocus(); // 不获取焦点
}
//将输入数据传入classinfo中
Intent intent=new Intent(ClassSearch.this,ClassInfo.class);
intent.putExtra("infoData",s);
startActivity(intent);
return true;
try {
ClientKey.put("classID", s);
Authorization.put("Class",ClientKey);
String content = String.valueOf(Authorization);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setConnectTimeout(5000);
//设置允许输出
conn.setDoOutput(true);
conn.setRequestMethod("POST");
//设置contentType
conn.setRequestProperty("Content-Type","application/json");
OutputStream os = conn.getOutputStream();
os.write(content.getBytes());
os.close();
} catch (JSONException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
ClientKey.put("classID", s);
这一行出现unreachable statement , 往前看,在try前面出现了return,所以永远不能到达这一行
P.S.这种基础错误很容易犯,以后要注意。
很赞哦! (0)
相关文章
- Python运行语法错误:IndentationError: unindent does not match any outer indentation level
- 异常解决:util.NativeCodeLoader: Unable to load native-hadoop library for your platform
- Java compiler level does not match the version of the installed Java project facet
- 心路历程——毕设程序mr跑不通的问题
- VMWARE虚拟机安装64位系统此主机支持IntelVTx 但IntelVTx处于禁用状态
- MapReduce报错:Error: java.io.IOException: Initialization of all the collectors failed. Error in last collector was :interface javax.xml.soap.Text
- 关于windows10上的sourcetree突然打不开的问题的解决策略
- module 'torch' has no attribute 'gesv'
- scp 文件 : /目录: Permission denied
- Maven C盘用户文件下没有.m2