webview에서 target="_blank" 링크를 열때 webview내에서가 아닌 외부의 브라우저로 여는 방법이다.
1. onCreate에 WebView설정
WebSettings set = mWebView.getSettings();
set.setSupportMultipleWindows(true);
2. onCreateWindow Override
mWebView.setWebChromeClient(new WebChromeClient() {
@Override
public boolean onCreateWindow(WebView view, boolean dialog, boolean userGesture, Message resultMsg)
{
WebView newWebView = new WebView(MainActivity.this);
view.addView(newWebView);
WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
transport.setWebView(newWebView);
resultMsg.sendToTarget();
return true;
}
});