title: Pass List array as params to Android AsynTask
body: <p>I have a small huge problem in my android app, I'm trying to pass an array list to the asynctask to post some data to an external api. But eclipse is allways returning a data type error and I cannot figure how to pass the params from the activity to the ASyncTask. Please help</p>
  
  <pre><code>  public void Login(View view){
      String usern = username.getText().toString();
      String pwd = password.getText().toString();
  
      List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;();
      nameValuePairs.add(new BasicNameValuePair("username", usern));
      nameValuePairs.add(new BasicNameValuePair("password", pwd));                
      nameValuePairs.add(new BasicNameValuePair("external-login", "true"));
  
      if(isNetworkAvailable()){
          GetAxiomaCredentials axiomacredentials = new GetAxiomaCredentials();
          axiomacredentials.execute();
      }else{
          Toast.makeText(this, "Network is not available.", Toast.LENGTH_LONG).show();
      }
  }
  </code></pre>
  
  <p>So there I can pass the nameValuePairs to execute as parameter but I get a bad type error from the AsyncTask Private class</p>
  
  <pre><code>  private class GetAxiomaCredentials extends AsyncTask&lt;ArrayList&lt;String&gt;, Integer, String&gt;{
  
      private static final String POST_URL = "http://192.168.0.105/index.php/r=rsite/heartbeat";
  
      @Override
      protected String doInBackground(ArrayList&lt;String&gt;... params) {
          int responseCode = -1;
          HttpClient httpclient = new DefaultHttpClient();
          HttpPost httppost = new HttpPost(POST_URL);
          try {
              // Add your data
              ArrayList&lt;String&gt; data = params[0];
              httppost.setEntity(new UrlEncodedFormEntity(data));
  
              // Execute HTTP Post Request
              HttpResponse response = httpclient.execute(httppost);
  
          } catch (ClientProtocolException e) {
              // TODO Auto-generated catch block
          } catch (IOException e) {
              // TODO Auto-generated catch block
          }
  
          return "Code: " + responseCode;
      }
  
      @Override
      protected void onProgressUpdate(Integer... progress) {
  
      }
  
      public void postData(String name, String email, String password,String mobile) {
          // Create a new HttpClient and Post Header
  
      }
  }
  </code></pre>
  
  <p>The eclipse compile error I'm getting is in this line:</p>
  
  <pre><code>  ArrayList&lt;String&gt; data = params[0];
          httppost.setEntity(new UrlEncodedFormEntity(data));
  </code></pre>
  
  <p>So how can i fix this to pass all parameters from the Login action in the activity to the AsyncTask?
  thanks</p>