博主csdn新人,今天用到了webview,有的需求是在webview中不用手机自带的浏览器打开url,而是在本应用中打开。代码如下:
webview.setWebViewClient(new WebViewClient() { public boolean shouldOverrideUrlLoading(WebView view, String url) { //打开指定的Activity Intent intent = new Intent(getContext(),OuterWebInfoActivity.class); CarouselEntity carouselEntity = new CarouselEntity(); carouselEntity.setJump_url(url); intent.putExtra(IntentFlag.DATA,carouselEntity); startActivity(intent); return true; } });