I've come across a peculiar problem in one of my apps recently. I
have a WebView that pulls down a webpage using loadUri(). This is
being loaded into an activity that has just the WebView and a Button
below the WebView inside a RelativeLayout. It works fine in the
emulator on Android 1.6, 2.1, and 2.2. However, it does not show the
webpage in Android 1.5. To strip things down to a bare minimum, I
used the following code from the API docs and tested it with similar
results:
-------------------------------------------------
final Activity activity = this;
// Let's display the progress in the activity title bar, like
the
// browser app does.
WebView webview = (WebView) findViewById(R.id.my_web_view);
webview.getSettings().setJavaScriptEnabled(true);
webview.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
// Activities and WebViews measure progress with different
scales.
// The progress meter will automatically disappear when we
reach 100%
activity.setProgress(progress * 1000);
}
});
webview.setWebViewClient(new WebViewClient() {
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
Toast.makeText(activity, "Oh no! " + description,
Toast.LENGTH_SHORT).show();
}
});
webview.loadUrl("http://slashdot.org/");
------------------------
Any thoughts as to what might be v1.5 specific that would cause this
to not work? Am I missing something here?
Thanks,
Justin
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en