GuiDupas GuiDupas - 1 year ago 61
Android Question

Android URL - Incomplete path

I am trying to create a

but it seems that when I create the
it isn't created with the full path.

Creating the URL

url = new URL("" + authID + "/Message/");

When I get the URL path


The result is:
I/System.out: /v1/Account/XXXXXXXXXXXXXXXX/Message/

Does anyone know how can I can solve this?

Answer Source

This is just printing out the "path" part of the URL (after the web address)

Try this to show what is happening, I think there is also a toString in url that will allow you to print the entire thing with just url

URL url = new URL("");
System.out.println(url.getHost() + url.getPath());

This outputs

Also see the reference