Hi,
I've a problem that is driving me mad. I have a webview where I load
an String with:
mContent.loadDataWithBaseURL(null, mBodyText, "text/html", mCharset,
null);
[I've also tried using a fake first argument for loadDataWithBaseURL,
and using "x-data://base"]
The webview has a webViewClient programmed to open the link in a
browser:
@Override public boolean shouldOverrideUrlLoading(WebView
view, String url) {
if (url.startsWith("attachment://")) {
/* Something that works */
}
else {
/* Works or doesn't work... see below */
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.addCategory("android.intent.category.BROWSABLE");
Uri myUri = Uri.parse(url);
intent.setData(myUri);
startActivity(intent);
return true;
}
}
[I also tried with a "return false" on the "else"]
The html displays correctly, but the non "attachment://" links (http,
ftp, etc.) have this odd behavior:
- On my Nexus One, if I touch a link, it get selected but NOT OPENED.
The shouldOverrideUrlLoading method is not called (I've put debug
prints and it never enters them for normal URLs)
- On my Nexus One again, if I go to the link with the D-Pad and click,
it works.
- On the emulator both things work, with any version of Android.
What could be happening here? Is it a bug? Is there a workaround?
Thaaaaaaaaaaaanks!!
--
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