0 url android webview android-layout
我在Android开发中是新手.在下面的代码中,它将打开Android浏览器.
1.有没有办法在webView中打开url(matricNo)而不是在Android浏览器中,而不必像在这个链接中那样构建新的java文件?
final void addToAttendance(String matricNo) {
String url = matricNo;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
activity.startActivity(intent);
}
Run Code Online (Sandbox Code Playgroud)
在活动中
public void onClick(View v)
{
// TODO Auto-generated method stub
//Context context = null;
Intent intent=new Intent(MainActivity.this,WebActivity.class);
intent.setData(Uri.parse("www.javacodegeeks.com"));
startActivity(intent);
}
});
Run Code Online (Sandbox Code Playgroud)
在另一个活动中
WebView wv=(WebView)findViewById(R.id.webView1);
wv.getSettings().setJavaScriptEnabled(true);
wv.loadUrl(this.getIntent().getDataString());
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3567 次 |
| 最近记录: |