We have a few android ‘optimized’ pages in our site and they do indeed come up quite nicely in the default browser. In my application WebView, it comes up looking like it doesn’t know anything about CSS.
For the record, I do have javascript enabled. Code is below. I haven’t examined the CSS in-depth, but I know, we had a guy come in and, at least, optimize these pages for mobile sized browsers. I’m concerned that in doing so, he might have done something that only works in the default browser.
Thoughts?
public class MyTest extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
try
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Locale locale = Locale.getDefault();
ConnectivityManager connectivityManager = (ConnectivityManager) this
.getSystemService(Activity.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connectivityManager
.getActiveNetworkInfo();
WebView webView = (WebView) findViewById(R.id.web_view);
webView.setHorizontalScrollBarEnabled(false);
webView.setVerticalScrollBarEnabled(false);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient()
{
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
return false;
}
});
if ((null != networkInfo) && (networkInfo.isConnected()))
{
String url = ApplicationProperties.BASE_URL;
webView.loadUrl(url);
}
else
{
webView.loadUrl("file:///android_res/drawable/no_connection_page_en.html");
}
}
catch (Exception Ex)
{
Log.v(ApplicationProperties.APPLICATION_NAME, Ex.getMessage());
}
}
}
For the record:
Seems I was authenticating improperly. I was using a http::@sub.domain.com. Didn’t fail, but once I switched to WebViewClient onReceivedHttpAuthRequest, everything started working correctly.
Bizarre.