title: How do pass multiple data types to HashMap
body: <p>I am trying to pass string and int data (possibly other data types like time) to a HashMap to use in a doinbackground task in Android to amend a URL. The URL uses key value pairs to update a mysql database.</p>
  
  <p>I've read about using an object to pass multiple variable types, but can't get it to work.</p>
  
  <pre><code>private void addChore(){
  
      final String title2 = editTextTaskTitle.getText().toString().trim();
      final String description2 = editTextDescription.getText().toString().trim();
      final String person2 = itemPerson.toString().trim();
      final int monday2 = cbMon;
  
      class NewChore1 {
  
          String title1;
          String description1;
          String person1;
          int monday1;
  
          NewChore1(String title1, String description1, String person1, int monday1){
  
              this.title1 = title1;
              this.description1 = description1;
              this.person1 = person1;
              this.monday1 = monday1;
          }
      }
  
      class AddChoreM extends AsyncTask&lt;Void,Void,String&gt; {
  
          ProgressDialog loading;
  
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
              loading = ProgressDialog.show(AddChore.this,"Adding...","Wait...",false,false);
          }
  
          @Override
          protected void onPostExecute(String s) {
              super.onPostExecute(s);
              loading.dismiss();
              Toast.makeText(AddChore.this,s,Toast.LENGTH_LONG).show();
          }
  
          @Override
          protected String doInBackground(Void... v) {
              HashMap&lt;String, NewChore1&gt; params1 = new HashMap&lt;&gt;();
  
              params1.put(Config.KEY_CHORE_TASK_TITLE,?);
              params1.put(Config.KEY_CHORE_DESCRIPTION,?);
              params1.put(Config.KEY_CHORE_PERSON,?);
              params1.put(Config.KEY_CHORE_MONDAY,?);
  
              RequestHandler rh = new RequestHandler();
              String res = rh.sendPostRequest(Config.URL_ADD, params1);
              return res;
          }
      }
  
      NewChore1 params = new NewChore1(title2, description2, person2, monday2);
      AddChoreM addChoreM = new AddChoreM();
      addChoreM.execute(params);
  }
  </code></pre>
  
  <p>In RequestHandler, I have used the following.</p>
  
  <pre><code>private String getPostDataString(HashMap&lt;String, Object&gt; params) throws UnsupportedEncodingException {
      StringBuilder result = new StringBuilder();
      boolean first = true;
      for (Map.Entry&lt;String, Object&gt; entry : params.entrySet()) {
          if (first)
              first = false;
          else
              result.append("&amp;");
  
          result.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
          result.append("=");
          result.append(URLEncoder.encode(entry.getValue(), "UTF-8"));
      }
  
      return result.toString();
  }
  </code></pre>