please predecessors, Am creating a web browser homepage in android studio and want to be able to input URL from the same editText as that of my search. have been able to take search and load google results, but URL still end up in searched instade of loading the URL website.
this is my codes.
EditText searchEditText = rootView.findViewById (R.id.searchEditText);
ImageButton searchBt = rootView.findViewById (R.id.searchBt);
searchBt.setOnClickListener (new View.OnClickListener ( ) {
@Override
public void onClick(View v) {
String searchQuery = searchBar.getText ().toString ();
if(URLUtil.isValidUrl (searchQuery)){
webView.loadUrl (searchQuery);
}else {
String searchURL = "https://www.google.com/search?q="+searchQuery;
webView.loadUrl (searchURL);
}
}
});