如何在按钮单击时在我的WebView中打开特定URL?我曾尝试这个代码,但它打开URL在默认浏览器,我希望它在相同的WebView在WebView中加载Url Onclick Android
public void openNewActivity(View view) {
Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW);
myWebLink.setData(Uri.parse("http://google.com"));
startActivity(myWebLink);
}
我也试过这一个打开URL,它工作正常!但它提示我选择一个应用程序,当我按下返回键,它的工作原理
public void openNewActivity(View view) {
Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW);
mWebView.loadUrl("http://google.com");
startActivity(myWebLink);
}