Android : Make AndroidWebView Act a 100% like Android Google Chrome

on Friday, October 10, 2014


Hi everyone i've got an android webview in my .xml layout and i want it to act a 100% like google chrome cos my webpage works just fine in google chrome itself but once i load it using android's webview it's got some problems...I added setWebChromeClient and know i can get alerts and things but page's still not like google chrome!Guess i need to call this function in another way or sth anyone any help?



setContentView(R.layout.activity_main);
WebView wv = (WebView)findViewById(R.id.webView1);
wv.setWebChromeClient(new WebChromeClient());
wv.getSettings().setJavaScriptEnabled(true);

wv.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
wv.loadUrl("MyPageURL");


For One thing which is working right in google chrome and not in this webview is to detect LandScape or Portrait Mode it's detecting landscape all the time !!I Detect LandScape or Portrait like this in my js code:



if (screen.width < screen.height)
alert('Running The Game in Portrait Mode!');
else
alert('Running The Game in LandScape Mode!');

0 comments:

Post a Comment