androiduriuribuilder

Is there a way to know if my UriI.Builder is making the right URL


Not a problem just something i can't find anywhere in my app I build a URL using Uri.Builder All I want to know if there is a way to see the end result of the Uri.Builder because there I do call information from several EditText boxes as well as spinners and I am unsure if it is actually giving the right URL

Here is the URL builder, as you can see i am pulling info from 2 edittext boxes as well as a spinner populated by json

Uri.Builder builder=new Uri.Builder();
        builder.scheme("https")
                .authority("www.smartpractice.co.za")
                .appendPath("files-upload-ruben.asp")
                .appendQueryParameter("MyForm", "Yes")
                .appendQueryParameter("ClientID", String.valueOf(R.id.clientid))
                .appendQueryParameter("Username", String.valueOf(R.id.emailtext))
                .appendQueryParameter("Pwd", String.valueOf(R.id.pwdtext))
        .appendQueryParameter("category", String.valueOf(R.id.spinner));
        myURL=builder.build().toString();

Solution

  • Call toString() on the builder object:

     builder.toString();
    

    Looks like you're already assigning the output to variable myURL, builder.toString(); calls through to builder.build().toString(); anyway, so either method will produce the same url.