[°³¹ß Tip] webview¿¡¼ À¯Æ©ºê µ¿ÀÛ½ÃÅ°±â |
|
|
 |
8³â Àü |
¸ÕÀú Ç÷¯±×ÀÎÀ» Enable½ÃÅ°¸é À¯Æ©ºê¸¦ Æ÷ÇÔÇÑ Ç÷¯±×ÀεéÀÌ Á¤»ó µ¿ÀÛÇÕ´Ï´Ù.
mWebView.getSettings().setPluginsEnabled(true);
´Ù¸¸ WebViewClient ¿¡¼ shouldOverrideUrlLoadingÀ» ¿À¹ö¶óÀ̵åÇÏ°Ô µÇ¸é Á¤»óÀûÀ¸·Î YouTubeÇ÷¯±×ÀÎÀÌ µ¿ÀÛÇÏÁö ¾Ê´Â °æ¿ì°¡ ÀÖ½À´Ï´Ù.
The Web page at file:///android_asset/webkit/ could not be loaded as: ¶ó´Â ¿¡·¯°¡ ¶å´Ï´Ù.
shouldOverrideUrlLoading ¿¡¼ ´ëºÎºÐÀÇ °æ¿ì http¸¸ ó¸®ÇÏ½Ã¸é µÉÅ×´Ï http¿¡¼¸¸ ÀÛ¾÷À» ó¸®ÇÏ°í ³ª¸ÓÁö ÀÛ¾÷Àº ±âº»ÀûÀ¸·Î ÀÛµ¿ÇÏ°Ô µÇ¾îÀÖ´Â ¹æ½Ä ±×´ë·Î µ¿ÀÛÇÏ°Ô ¸¸µé¾îÁÖ¸é Ç÷¯±×ÀÎÀÌ Á¦´ë·Î µ¿ÀÛÇÕ´Ï´Ù
mWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String overrideUrl) {
if(overrideUrl.startsWith("http://")) {
doSomething
return true;
} else {
boolean override = false;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(overrideUrl));
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.putExtra(Browser.EXTRA_APPLICATION_ID, getPackageName());
try {
startActivity(intent);
override = true;
} catch (ActivityNotFoundException ex) {
}
return override;
}
}
); |
|
̵̧ : 300 |
̵̧
¸ñ·Ï
|
|