Hi Matt!

You need to do something like this:

@Override
public void onCreate(Bundle savedInstanceState) {

WebView webkit = (WebView) findViewById(R.id.web_view);

On Oct 13, 12:17 am, Croccy22 <[email protected]> wrote:
> Hi all,
>
> I have a WebView in my layout which I want to display a web page in.
> However the webpage requires Basic Authentication.
>
> If I try to access this web page in the normal android browser, I get
> prompted for a username and password which then gets remembered and
> works for the site in future.
>
> I want to do the same thing in my application, but when I load the
> page into the webview it just comes straigt up with the Unauthorised
> message without prompting.
>
> I guess the prompting for Authentication is  written in code in the
> android browser. Does anyone know how to inject a username and
> password into the WebView?
>
> I have done a search arond and found the setHttpAuthUsernamePassword
> (String host, String realm, String username, String password) Method,
> But  can't seem to get it to work and I can't find anyone else who has
> either? Not sure if I am giving it the correc parameters as I'm a
> little confused by what is means as the Realm?
>
> I assumed that if the site was myhost.dyndns.org then the hostname
> would be myhost and the realm would be dyndns.org? This didn't seem to
> work. I also tried connecting by IP Address but that makes the Realm
> setting even more confusing?
>
> Any ideas on how I can get this working?
>
> Thanks, Matt.

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