I want to ask you a question about setHeader in android , I am trying to modify setEntity :
httpPost.setEntity(new UrlEncodedFormEntity(params, "utf-8"));
to :
StringEntity stringEntity = new StringEntity("name=value1&price=value2$=&description=value3", "UTF-8");
httpPost.setEntity(stringEntity);
In my sever , _POST can't receive information util I add header to httpPost :
httpPost.setHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");
I do the same with HttpURLConnection , just change "name=value1&price=value2&description=value3" to bytes then write in outputStream and _POST can receive information . Why do I have to setHeader to httpPost?