How can i delete one particular row in the http database? I am thinking to use httpDelete like httpGet, but it doesnt work.
This is my code of post and delete. I am affair that by using that deleteMarkerData(), I delete the entire table instead of just one.
public void postCarData() {
Thread t = new Thread() {
public void run() {
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost( CAR_URI);
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(5);
nameValuePairs.add(new BasicNameValuePair("name", String.valueOf(lat)));
nameValuePairs.add(new BasicNameValuePair("description", ""));
nameValuePairs.add(new BasicNameValuePair("price", String.valueOf(lon)));
nameValuePairs.add(new BasicNameValuePair("product", UserLogin.accountName ));
nameValuePairs.add(new BasicNameValuePair("action", "put"));
post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = client.execute(post);
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
String line = "";
while ((line = rd.readLine()) != null) { Log.d(TAG, line); }
} catch (IOException e) { Log.d(TAG, "IOException while trying to conect to GAE"); }
}
};
t.start();
}
public void deleteCarData() throws ClientProtocolException, IOException {
HttpClient client = new DefaultHttpClient();
HttpDelete delete = new HttpDelete( CAR_URI );
client.execute(delete);
}