To create new HttpUrl.Builder instance from existing URL I use HttpUrl.newBuilder(String):
new HttpUrl().build().newBuilder(savedUrl)
where savedUrl is a String containing well-formed URL.
The above fragment crashes in HttpUrl constructor because of scheme is undefined. As a workaround I use existing HttpUrl instance - less than ideal.
The questions are:
- is newBuilder(String) the right tool for the job?
- how newBuilder(String) should be used properly?