現在、特定のボタンを押すと、Web ページを webView に開く意図が開始されますが、代わりにブラウザ アプリケーションが開き、必要ではないアドレス バーが表示されます。
いくつかの調査を行った後、shouldOverrideUrlLoading() メソッドを使用してこれを停止し、webView でページを開くことができることがわかりましたが、コードにこのメソッドを実装する方法がわかりません。助けていただければ幸いです!
これは、Webページを開こうとしているクラスにあるものです。
public class Codes extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.codes);
View titleView = getWindow().findViewById(android.R.id.title);
if (titleView != null) {
ViewParent parent = titleView.getParent();
if (parent != null && (parent instanceof View)) {
View parentView = (View)parent;
parentView.setBackgroundColor(Color.rgb(228, 108, 10));
}
}
WebView codes = (WebView)findViewById(R.id.codesWebView);
codes.getSettings().setJavaScriptEnabled(true);
codes.loadUrl("http://dev10.affirmaconsulting.com:24009/keyentry");
shouldOverrideUrlLoading(codes, "http://dev10.affirmaconsulting.com:24009/keyentry");
}
}