public static void submitStackTraces(Context context) {
    Log.d(Constants.TAG, "Looking for exceptions in: " + Constants.FILES_PATH);
    String[] list = searchForStackTraces();

    if ((list != null) && (list.length > 0)) {
      Log.d(Constants.TAG, "Found " + list.length + " stacktrace(s).");

      for (int index = 0; index < list.length; index++) {
        try {
          // Read contents of stack trace
          StringBuilder contents = new StringBuilder();
          BufferedReader reader = new BufferedReader(new InputStreamReader(context.openFileInput(list[index])));
          String line = null;
          while ((line = reader.readLine()) != null) {
            contents.append(line);
            contents.append(System.getProperty("line.separator"));
          }
          reader.close();
          String stacktrace = contents.toString();

          // Transmit stack trace with POST request
          Log.d(Constants.TAG, "Transmitting crash data: \n" + stacktrace);
          DefaultHttpClient httpClient = new DefaultHttpClient(); 
          HttpPost httpPost = new HttpPost(getURLString());
          List <NameValuePair> nvps = new ArrayList <NameValuePair>(); 
          nvps.add(new BasicNameValuePair("raw", stacktrace));
          httpPost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8)); 
          httpClient.execute(httpPost);                                   
        }
        catch (Exception e) {
          e.printStackTrace();
        } 
        finally {
          try {
            context.deleteFile(list[index]);
          } 
          catch (Exception e) {
            e.printStackTrace();
          }
        }
      }
    }
  }