@@ -0,0 +1,2490 @@
+package adarsh.awesomeapps.androidtracker;%0A%0Aimport java.io.IOException;%0Aimport java.io.UnsupportedEncodingException;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport org.apache.http.HttpEntity;%0Aimport org.apache.http.HttpResponse;%0Aimport org.apache.http.NameValuePair;%0Aimport org.apache.http.client.ClientProtocolException;%0Aimport org.apache.http.client.entity.UrlEncodedFormEntity;%0Aimport org.apache.http.client.methods.HttpPost;%0Aimport org.apache.http.impl.client.DefaultHttpClient;%0Aimport org.apache.http.message.BasicNameValuePair;%0Aimport org.apache.http.util.EntityUtils;%0A%0Aimport android.app.ProgressDialog;%0Aimport android.content.Context;%0Aimport android.os.AsyncTask;%0A%0A/*%0A *  This class is used to send HTTP POST requests to the server.%0A */%0Apublic class ServerRequest extends AsyncTask%3CString, Void, String%3E%0A%7B%0A%09/* reply stores the reply from the server. */%0A%09String reply;%0A%09Context context;%0A%09%0A%09/* constructor for the object. */%0A%09public ServerRequest(Context ctx)%0A%09%7B%0A%09%09/* context of the caller. */%0A%09%09context = ctx;%0A%09%09reply = %22%22;%0A%09%7D%0A%09%0A%09@Override%0A%09protected void onPreExecute()%0A%09%7B%0A%09%09super.onPreExecute();%0A%09%7D%0A%09%0A%09protected String doInBackground(String... arguments)%0A%09%7B%0A%09%09/* create a httpClient and a new post request. */%0A%09%09DefaultHttpClient httpClient = new DefaultHttpClient();%0A%09%09HttpPost httpPostRequest = new HttpPost(%22http://172.16.0.43/AndroidTracker/%22+arguments%5B0%5D);%0A%09%09%0A%09%09/* extracting the number of arguments in the post requests. */%0A%09%09int numberOfArguments = Integer.parseInt(arguments%5B1%5D);%0A%09%09%0A%09%09/* creating the name-value pairs for the post request. */%0A%09%09List%3CNameValuePair%3E nameValuePairs = new ArrayList%3CNameValuePair%3E(numberOfArguments);%0A%09%09for(int i=2; i%3C(numberOfArguments*2)+2; i=i+2)%0A%09%09%09nameValuePairs.add(new BasicNameValuePair(arguments%5Bi%5D, arguments%5Bi+1%5D));%0A%09%09%0A%09%09try %0A%09%09%7B%0A%09%09%09/* sending the post request. */%0A%09%09%09httpPostRequest.setEntity(new UrlEncodedFormEntity(nameValuePairs));%0A%09%09%09HttpResponse httpResponse = httpClient.execute(httpPostRequest);%0A%09        %0A%09%09%09HttpEntity httpEntity = httpResponse.getEntity();%0A%09%09%09reply = EntityUtils.toString(httpEntity);%0A%09%09%7D %0A%09%09catch (UnsupportedEncodingException e)%0A%09%09%7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D %0A%09%09catch (ClientProtocolException e)%0A%09%09%7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%09catch (IOException e) %0A%09%09%7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%09%0A%09%09return reply;%0A%09%7D%0A%09%0A%09protected void onPostExecute(String reply)%0A%09%7B%0A%09%09super.onPostExecute(reply);%0A%09%7D%0A%09%0A%09/* This function returns the reply string. */%0A%09public String getReply()%0A%09%7B%0A%09%09return reply;%0A%09%7D%0A%7D%0A

Create ServerRequest.java