首页> 开发问题 >其它问题 其它问题
Unreachable statement
作者:小萝卜 2019-11-29 【 漏洞BUG 】 浏览 1272
简介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)
相关文章
- Java compiler level does not match the version of the installed Java project facet
- Maven C盘用户文件下没有.m2
- 无法定位程序输入点到xxx.dll
- windows10 onenote 显示英文 怎么办?
- git中报unable to auto-detect email address
- 心路历程——毕设程序mr跑不通的问题
- Python问题:SyntaxError: Non-ASCII character '\xe2' in file
- clion ctrl+鼠标左键不能调到函数实现
- matlab命令行双箭头消失
- TypeError: 'newline' is an invalid keyword argument for this function 错误解决