Does this code snippet work for anybody else with Froyo?
On Tue, Jun 29, 2010 at 8:22 PM, Mariano Kamp <[email protected]>wrote:
> Hi.
>
> using a WebView with Froyo I don't see the YouTube thumbnails anymore.
> WebViewClient.shouldOverrideUrlLoading() is not called in Froyo, but was
> called before. Please check out the example below. With Pre-Froyo you would
> see a YouTube thumbnail two/thirds into the article, with Froyo you don't.
>
> Any ideas?
>
> Cheers,
> Mariano
>
> public class WebViewTestActivity extends Activity {
> /** Called when the activity is first created. */
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.main);
> WebView wv = (WebView) findViewById(R.id.webview);
> wv.setWebViewClient(new WebViewClient() {
> public boolean shouldOverrideUrlLoading(WebView view,
> String url) {
>
> if (url.startsWith("http:") ||
> url.startsWith("https:"))
> return false;
>
> Intent intent;
>
> try {
> intent = Intent.parseUri(url,
> Intent.URI_INTENT_SCHEME);
> } catch (URISyntaxException ex) {
> Log.w("Browser", "Bad URI " + url + ":
> " + ex.getMessage());
> return false;
> }
>
> if (getPackageManager().resolveActivity(intent,
> 0) == null) {
> String packagename =
> intent.getPackage();
> if (packagename != null) {
> intent = new
> Intent(Intent.ACTION_VIEW,
>
> Uri.parse("market://search?q=pname:"
>
> + packagename));
>
> intent.addCategory(Intent.CATEGORY_BROWSABLE);
> startActivity(intent);
> return true;
> } else {
> return false;
> }
> }
>
> intent.addCategory(Intent.CATEGORY_BROWSABLE);
> intent.setComponent(null);
> try {
> if (startActivityIfNeeded(intent, -1)) {
> return true;
> }
> } catch (ActivityNotFoundException ex) {
> }
>
> return super.shouldOverrideUrlLoading(view,
> url);
> }
>
> });
>
> wv.getSettings().setPluginsEnabled(true);
> wv
>
> .loadUrl("http://www.fscklog.com/2010/06/sammelsurium-zweite-ipad-
> auslieferungswelle-scheint-anzulaufen-iphone-codesperre-kann-auch-unter-windows-
> ausgetrickst-werde.html");
> }
> }
>
>
--
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