I saw that the version of Android API 22 DefaultHttpClient is deprecated. In my old code I had to send data to a PHP page and get the response that the page php returned. By using this code:
HttpClient client = new DefaultHttpClient(); HttpPost request = new HttpPost("php page"); ArrayList<NameValuePair> parameters = new ArrayList<NameValuePair>(); parameters.add(new BasicNameValuePair("username", "user")); parameters.add(new BasicNameValuePair("password", "pw")); HttpResponse response = client.execute(request); String responseMessage = response.getEntity().toString(); I saw that NameValuePair is deprecated. My question is how can I do the same thing in another way not deprecated. As I said I need to send data (via post) to a php page and get what page PhP printing. (In my case a string JSON). Many thanks in advance!!.