i had problems when getting this warning..
//import org.apache.http.impl.client.DefaultHttpClient
'import org.apache.http.params.BasicHttpParams' is deprecated
'import org.apache.http.params.HttpConnectionParams' is deprecated
'import org.apache.http.params.HttpParams' is deprecated
import org.apache.http.protocol.HTTP
import org.json.JSONArray
import org.json.JSONException
import org.json.JSONObject
//import org.apache.http.impl.client.CloseableHttpClient
import org.apache.http.impl.client.HttpClientBuilder
//import java.io.IOException
function (timeout code based on this answer by kuester2000)
try {
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
//HttpClient httpclient = new DefaultHttpClient();
HttpClient httpclient =HttpClientBuilder.create().build();
try{
HttpPost httppost = new HttpPost("http://10.0.2.2/hari.php");
StringEntity se = new StringEntity("envelope",HTTP.UTF_8);
httppost.setEntity(se);
HttpParams httpParameters = new BasicHttpParams();
// Set the timeout in milliseconds until a connection is established.
int timeoutConnection = 3000;
HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);
// Set the default socket timeout (SO_TIMEOUT)
// in milliseconds which is the timeout for waiting for data.
int timeoutSocket = 3000;
HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
is = entity.getContent();
}
catch(Exception e){
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
}
i am using android 5.1.1(API22)..what should i do when i got this warning error deprecated?anyone can help me?thanks in advance.