WebView is powered by WebKit. I know of no way to add protocol
handlers to WebKit via Java. There might be a way to do this via some
sort of WebKit plugin, but I don't know the first thing about that.

Depending on how the URLs are being used, a better choice may be to
use WebViewClient and shouldOverrideUrlLoading(), and handle it that
way. Or, if you have control over the implemented Web pages, consider
switching from custom URLs to Javascript invoking Java via objects you
add to the WebView via addJavascriptInterface().

On Sat, Nov 6, 2010 at 9:30 PM, paulb <[email protected]> wrote:
> G'day guys,
>
> I am hoping to create my own protocol handler for urls in a webview.
>
> I have tried two approaches already. The first was to attempt
> something similar to the approach defined here to create a customer
> protocol handler.
>
>    http://java.sun.com/developer/onlineTraining/protocolhandlers/
>
> This works in a command-line Java program if I correctly set the
> system property java.protocol.handler.pkgs, but it does not work in
> Android, probably because I cannot figure out where to define this
> system property. Defining the system property in the code does not
> work. I assume this is because it needs to be loaded when the
> application first starts.
>
> I have also attempted to use URL.setURLStreamHandlerFactory. This
> works for creating URL objects within the code, but it does not seem
> to be associated with the WebView.
>
>
> Any ideas on how to get this working?
>
>
> Cheers
>
> paulb
>
> --
> 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
>



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.2 Available!

-- 
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

Reply via email to