I'm trying to update a MySQL data in Android by making HTTP Request but it gives me an error
"Type mismatch: cannot convert from org.apache.http.HttpResponse to com.google.api.client.http.HttpResponse"
on this line of code "httpClient.execute(httpPost)"
HttpResponse response = httpClient.execute(httpPost);
and it gives and option to quick fix by adding org.apache.http like
org.apache.http.HttpResponse response = httpClient.execute(httpPost);
Could someone tell me what I'm doing wrong here? Thank you so much!
protected String doInBackground(String... params) {
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("http://---.com/---/approve_request.php");
List<NameValuePair> nameValuePair = new ArrayList<NameValuePair>();
nameValuePair.add(new BasicNameValuePair("status", "Approved"));
try {
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePair));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
try {
org.apache.http.HttpResponse response = httpClient.execute(httpPost);
Log.d("Http Response:", response.toString());
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}