So I'm new to Android Development. and I'm writing a Browser app for practice. The goal is for a user to be able to enter a URL and a website pulls up or just keywords for a google search in the search/browser bar. The problem im having is, its just preforming google searches but does not recognize if a URL was entered. I have no errors. debugging makes me feel as if the app is fine and working and there are no errors that's stopping the app. Im at a loss in my head for what the problem could be. below is the code
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
if (editText.getText().toString() == "whateverText") {
// this line is looking for a keyword or URL
}
webView.loadUrl("https://" + editText.getText().toString());
webView.loadUrl("https://www.google.com/#q=" + editText.getText());
/* these 2 lines are needed to identify if its a URL search or Keyword search */
}
});
I've coded with Booleans before in the past, I'm just lost to where and how I implement this within a browser. from my understanding a Boolean cannot be set up with a public void and the android studio reference site is not giving me much info. please help if you can. it would be greatly appreciated. thanks in advance