title: Recevied multiple null parameters thorught GET method from a android app to a servlet
body: <p>Im trying to send some parameters from a simple android app using AsyncTask&lt;>
  through a get request ,but when i get the parameters on the servlet those are null!
  And i cant understand why... , logcat doesnt show any errors so i cant find why..
  here is my main activity :</p>
  
  <pre><code>package com.theopentutorials.android;
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.net.HttpURLConnection;
  import java.net.URL;
  import java.net.URLConnection;
  import android.app.Activity;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.TextView;
  
  //the main activity
  public class HttpGetServletActivity extends Activity implements OnClickListener {
  Button button; // gui part
  TextView outputText;
  EditText titulli;
  EditText ingredientet;
  EditText receta;
  
  public static String getTitulliS() {
      return titulliS;
  }
  
  // setters and getters of the url parameters
  public static void setTitulliS(String titulliS) {
      HttpGetServletActivity.titulliS = titulliS;
  }
  
  public static String getIngredientetS() {
      return ingredientetS;
  }
  
  public static void setIngredientetS(String ingredientetS) {
      HttpGetServletActivity.ingredientetS = ingredientetS;
  }
  
  public static String getRecetaS() {
      return recetaS;
  }
  
  public static void setRecetaS(String recetaS) {
      HttpGetServletActivity.recetaS = recetaS;
  }
  
  public static String getURL() {
      return URL;
  }
  
  public static void setURL(String uRL) {
      URL = uRL;
  }
  
  // the parameters i would like to send
  static String titulliS;
  static String ingredientetS;
  static String recetaS;
  static String URL = "http://10.0.2.2:8080/HttpGetServlet/HelloWorldServlet?"
          + getTitulliS() + getIngredientetS() + getRecetaS();
  
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      findViewsById();
  
      button.setOnClickListener(this);
  }
  
  private void findViewsById() {
      button = (Button) findViewById(R.id.button);
      outputText = (TextView) findViewById(R.id.outputTxt);
      titulli = (EditText) findViewById(R.id.editText1);
      ingredientet = (EditText) findViewById(R.id.editText2);
      receta = (EditText) findViewById(R.id.editText2);
      setTitulliS("titulli=" + titulli.getText().toString() + "&amp;");
      setIngredientetS("ingredientet=" + ingredientet.getText().toString()
              + "&amp;");
      setRecetaS("receta=" + receta.getText().toString());
  
  }
  
  public void onClick(View view) {
  
      GetXMLTask task = new GetXMLTask();
      task.execute(new String[] { URL });
  }
  
  private class GetXMLTask extends AsyncTask&lt;String, Void, String&gt; {
      @Override
      protected String doInBackground(String... urls) {
          String output = null;
          for (String url : urls) {
              output = getOutputFromUrl(url);
          }
          return output;
      }
  
      private String getOutputFromUrl(String url) {
          StringBuffer output = new StringBuffer("");
          try {
              InputStream stream = getHttpConnection(url);
              BufferedReader buffer = new BufferedReader(
                      new InputStreamReader(stream));
              String s = "";
              while ((s = buffer.readLine()) != null)
                  output.append(s);
          } catch (IOException e1) {
              e1.printStackTrace();
          }
          return output.toString();
      }
  
      // Makes HttpURLConnection and returns InputStream
      private InputStream getHttpConnection(String urlString)
              throws IOException {
          InputStream stream = null;
          URL url = new URL(urlString);
          URLConnection connection = url.openConnection();
  
          try {
              HttpURLConnection httpConnection = (HttpURLConnection) connection;
              httpConnection.setRequestMethod("GET");
              httpConnection.connect();
  
              if (httpConnection.getResponseCode() == HttpURLConnection.HTTP_OK) {
                  stream = httpConnection.getInputStream();
              }
          } catch (Exception ex) {
              ex.printStackTrace();
          }
          return stream;
      }
  
      @Override
      protected void onPostExecute(String output) {
          outputText.setText(output);
      }
  }
  }
  </code></pre>
  
  <p>and here is my simple servlet :</p>
  
  <pre><code>import java.io.IOException;
  import java.io.PrintWriter;
  import javax.servlet.ServletException;
  import javax.servlet.annotation.WebServlet;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  @WebServlet("/HelloWorldServlet")
  public class HelloWorldServlet extends HttpServlet {
  private static final long serialVersionUID = 1L;
  
  public HelloWorldServlet() {
      super();
  }
  
  protected void doGet(HttpServletRequest request,
          HttpServletResponse response) throws ServletException, IOException {
         String titulli =  request.getParameter("titulli");
        String ingredientet =  request.getParameter("ingredientet");
         String receta =  request.getParameter("receta");
          PrintWriter out = response.getWriter();
          out.println(titulli+ingredientet+receta);
          System.out.println(titulli+ingredientet+receta);
  }
  }
  </code></pre>
  
  <p>Does somebody have any idea?Thank you in advance !</p>