Programming Tips - Java: Make the body for an HTTP POST that is url-encoded

Date: 2014jan29 Language: Java OS: Android Q. Java: Make the body for an HTTP POST that is url-encoded A.
import android.net.Uri.Builder; ... Builder builder = new Uri.Builder(); builder.appendQueryParameter("param1", param1); builder.appendQueryParameter("param2", param2); builder.appendQueryParameter("param3", param3); String data = builder.build().toString(); if (data.startsWith("?")) { data = data.substring(1); } // Now you can use "data" as the body of a POST