我听到说cannot return a value from a method with void result type
的错误
这里retutn true;
我尝试将void
更改为string
并紧随Void methods cannot return a value -Java和Cannot return value from a method with void result type之后,还发现了很多错误。
可以帮上忙。
@Override
public void onClick(View view) {
String url = superUrl.getText().toString();
if (superUrl.getText().toString().contains("http://")
|| superUrl.getText().toString()
.contains("https://")) {
superWebview.loadUrl(url);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(superUrl.getWindowToken(),0);
return true; // error here
} else if (superUrl.getText().toString().contains(".com")
|| superUrl.getText().toString().contains(".net")
|| superUrl.getText().toString().contains(".org")
|| superUrl.getText().toString().contains(".gov")) {
superWebview.loadUrl("http://"
+ url);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(superUrl.getWindowToken(),0);
return true; // error here error here
} else {
superWebview.loadUrl("https://www.safebrowser.tk/search?q="
+ url);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(superWebview.getWindowToken(),
0);
MainActivity.this.superProgressbar.setProgress(0);
}
}