Any quick way to extract base url from full url? for e.g., if i have http://test.example.com/abcd/test.html - i want only http://test.example.com.
I can always do strin
There's nothing in the Android URI class that gives you the base URL directly- As gnuf suggests, you'd have to construct it as the protocol + getHost().
The string parsing way might be easier and let you avoid stuffing everything in a try/catch block. Just take a substring of the URL, everything from the beginning of the string to the third "/" symbol.