title: How To Pass A Parameters To AsyncTask (Ksoap2)
body: <p>Hi All I want to pass a Variables to AsyncTask</p>
  
  <p>I've This Variables</p>
  
  <pre><code>private static String NAMESPACE = "aaa";
  private static String METHOD_NAME = "bbb";
  private static String SOAP_ACTION =  NAMESPACE + METHOD_NAME ;
  private static String URL = "ccc";
  </code></pre>
  
  <p>and I've This Task</p>
  
  <pre><code>    public class Login extends AsyncTask&lt;Void, Void, String&gt;
      {
      ProgressDialog progress;
  String response = "";
      private ProgressDialog pDialog;
  public void onPreExecute() 
    {
      super.onPreExecute();
      pDialog = new ProgressDialog(MainActivity.this);
      pDialog.setMessage("Please Wait");
      pDialog.setIndeterminate(false);
      pDialog.setCancelable(false);
      pDialog.show();
    }
      @Override
  protected String doInBackground(Void... arg0)       {
           final SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);             
           request.addProperty("username", user_name);
           request.addProperty("userpass", user_pass);
           final SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
           envelope.setOutputSoapObject(request);
           envelope.dotNet = true;
           try 
              {
                      HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
                      androidHttpTransport.call(SOAP_ACTION, envelope);                    
                      SoapPrimitive result = (SoapPrimitive) envelope.getResponse();          
                      response = result.toString();
              }
           catch (IOException e) 
              {
               response = "Error In The Operation(1) !!\n Check Internet Connection And TRY AGAIN.";
              }
           catch (Exception e) 
              {
               response = "Error In The Operation(2) !!\n Check Internet Connection And TRY AGAIN.";
              } 
      return response;
      }
  @Override
  public void onPostExecute(String res)
  {
              if(!(res.equalsIgnoreCase("")))
              {
                       if (res.toString().contains(",") == true)
                       {
                     String[] separated = res.split(",");
                     tv.setText(separated[1]);
                     return;
                       }
  
                   if(res.toString().equals("1"))
                   {
                       res = "Wrong User name OR password ,, TRY AGAIN ..";
                       tv.setText(res);
                       pDialog.dismiss();
                       return;
                   }
                   if(res.toString().equals("2"))
                   {
                       res = "Your Account Is temporarily Blocked ,, Please Call The Admin";
                       tv.setText(res);
                       pDialog.dismiss();
                       return;
                   }
                   if(res.toString().equals("3"))
                   {
                       res = "Error While Retrieve S Information ,, Try Again Later .";
                       tv.setText(res);
                       pDialog.dismiss();
                       return;
                   } 
                  tv.setText(res);
                  pDialog.dismiss();
              }
  }
      }
  </code></pre>
  
  <p>I Need When I Want To Execute this Taks</p>
  
  <p>To Call It And Pass The Above Variables </p>
  
  <p>Like</p>
  
  <pre><code>new Login().execute();
  </code></pre>
  
  <p>Make It </p>
  
  <pre><code>new Login().execute(URL,NAMESPACE,METHOD,USERNAME,USERPASS);
  </code></pre>
  
  <p>With Knolledge That this task return a String :)</p>
  
  <p>AND THE <strong>doInBackground</strong> MUST HAVE a value for user_name &amp; user_pass Need To Pass It With Execution Call ..</p>
  
  <p>Regards ...</p>