title: Using putExtra to pass values to intent service
body: <p>within my main activity I have the following code:</p>
  
  <pre><code>EditText usernameText;
  EditText passwordText;
  public void sendLogin (View loginview){
      Intent i = new Intent(this, NetworkService.class);
      startService(i);
  }
  </code></pre>
  
  <p>Currently, this just sends an intent to the NetworkService, which is handled as follows (truncated):</p>
  
  <pre><code>public class NetworkService extends IntentService {
  
      public NetworkService() {
          super("NetworkService");
      }
  
      protected void onHandleIntent(Intent i) {
  
          /* HTTP CONNECTION STUFF */
  
          String login = URLEncoder.encode("Username", "UTF-8") + "=" + URLEncoder.encode("XXX", "UTF-8");
          login += "&amp;" + URLEncoder.encode("Password", "UTF-8") + "=" + URLEncoder.encode("XXX", "UTF-8"); 
      }
  }
  </code></pre>
  
  <p>Now, what I need to figure out, is how to pass those <code>usernameText</code> and <code>passwordText</code> values through to the <code>NetworkService</code> into the 'XXX', but ALSO within the <code>NetworkService</code>, I intend (no pun intended), to have it handle multiple intents from various places, one from a login, one from retrieving some information on users using the logon token, for instance. 
  It's where all my networking will be contained. I was instructed this was the best practise within android applications, to keep the networking separate.</p>
  
  <p>My question is: What is the best way of sending those two variables to the <code>NetworkService</code> and also how, within the <code>onHandleIntent</code> of the <code>NetworkService</code>, do I separate the code to only do what I'm asking it to (login, fetch user information, fetch location data etc)?</p>
  
  <p>Sorry if the answer is a simple one, but I'm very new to application programming.</p>
  
  <p>Thanks</p>