有人可以解释我在尝试从网上下载 .apk 时如何模仿默认浏览器吗?
到目前为止,我有这个:
WebView webview;
@Override
public void onCreate(Bundle icicle)
{
super.onCreate(icicle);
setContentView(R.layout.main);
webview = (WebView) findViewById(R.id.webview);
webview.setWebViewClient(new HelloWebViewClient());
WebSettings webSettings = webview.getSettings();
webSettings.setSavePassword(false);
webSettings.setSaveFormData(false);
webSettings.setJavaScriptEnabled(true);
webSettings.setSupportZoom(false);
webview.setDownloadListener(new DownloadListener() {
public void onDownloadStart(final String url, String userAgent,
String contentDisposition, String mimetype,
long contentLength) {
Toast.makeText(testapp.this, url, Toast.LENGTH_LONG);
}
});
webview.loadUrl("http://dacp.jsharkey.org/TunesRemote-r2.apk");
}
我已经添加了使用互联网的权限。我还需要添加其他权限吗?我是否错误地执行了 DownloadListener?
先感谢您!