title: Android Parse Query with mutltiple conditions
body: <p>I hope you can help me with these
  I am trying to extract information from my parse database for my android app (just a viewing app)
  Basically what I want to do is I go select on my two spinners and click view
  Once I click view it should query on three conditions </p>
  
  <p>1st condition: current parse user = current user (from database)
  2nd condition: selected item on spinner one (spin Month) =  month (from database)
  3rd condition: selected item on spinner two (spin Year) = year (from database)</p>
  
  <p>Then it will give me the data needed for each text view (I was able to do this with just one condition but I need to specify it into 3 conditions)</p>
  
  <p>Class Name: payslip
  Column Name from class: username, month, year</p>
  
  <p>I'm not sure which or what kind of if statement, switch case, or anything I can use so I can fit these 3 conditions
  Thanks a bunch for the help!  </p>
  
  <pre><code>    a = (Spinner) findViewById(R.id.spinMonth);
  ArrayAdapter adapterA = new ArrayAdapter(this,
  android.R.layout.simple_spinner_item, month);
  a.setAdapter(adapterA);
  
  b = (Spinner) findViewById(R.id.spinYear);
  ArrayAdapter adapterB = new ArrayAdapter(this,
  android.R.layout.simple_spinner_item, year);
  b.setAdapter(adapterB);
  
    ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery("payslip");
      query.whereEqualTo("username",ParseUser.getCurrentUser().getUsername());
      query.findInBackground(new FindCallback&lt;ParseObject&gt;() {
          @Override
        public void done(List&lt;ParseObject&gt; res, ParseException e) {
          if (res == null) {
              Toast.makeText(getApplicationContext(),
                      "Data Retrieved",
                      Toast.LENGTH_LONG).show();
          } else {
              Toast.makeText(getApplicationContext(),
                      "Data Not Retrieved",
                      Toast.LENGTH_LONG).show();
          }
        }
      });
  
      stringmonth = (String) a.getSelectedItem();
      stringyear = (String) b.getSelectedItem();
  
  
      view.setOnClickListener(new OnClickListener() {
  
          public void onClick(View arg0) {
  
  
  
                  ParseQuery&lt;ParseObject&gt; mainQuery = ParseQuery.getQuery("payslip");
                  mainQuery.whereEqualTo("month",stringmonth);
                  mainQuery.whereEqualTo("year",stringyear);
                  mainQuery.findInBackground(new FindCallback&lt;ParseObject&gt;() {
                      @Override
                      public void done(List&lt;ParseObject&gt; results, ParseException e) {
  
  
                          // TODO Auto-generated method stub
                           if (e == null) {
  
                               for (ParseObject x : results) { 
                                   String name = x.getString("name");
                                   basic = x.getDouble("basicpay");
                                   Double regot = x.getDouble("regot");
                                   Double nightdiff = x.getDouble("nightdiff");
                                   Double sss = x.getDouble("sss");                   
                                   Double hdmf = x.getDouble("hdmf");
                                   Double philhealth = x.getDouble("philhealth");
                                   Double tax = x.getDouble("tax");
                                   Double adjustment = x.getDouble("adjustment");                                                                              
  
                                   txtName.setText(name);
                                   String stringbasic = Double.toString(basic);
                                   txtBasic.setText(stringbasic);
                                   String stringregot = Double.toString(regot);
                                   txtRegot.setText(stringregot);
                                   String stringnd = Double.toString(nightdiff);
                                   txtND.setText(stringnd);
                                   String stringsss = Double.toString(sss);
                                   txtSSS.setText(stringsss);
                                   String stringhdmf = Double.toString(hdmf);
                                   txtHDMF.setText(stringhdmf);
                                   String stringphilhealth = Double.toString(philhealth);
                                   txtPhilhealth.setText(stringphilhealth);
                                   String stringtax =Double.toString(tax);
                                   txtTax.setText(stringtax);
                                   String stringadjust = Double.toString(adjustment);
                                   txtAdjust.setText(stringadjust);
                                   gross = Double.valueOf(basic)+Double.valueOf(regot)+Double.valueOf(nightdiff);
                                   String stringgross = Double.toString(gross);
                                   txtGross.setText(stringgross);
                                   deduction = Double.valueOf(sss)+Double.valueOf(hdmf)+Double.valueOf(tax)+Double.valueOf(philhealth);
                                   String stringdeduction= Double.toString(deduction);
                                   txtDeductions.setText(stringdeduction);
                                   netpay= gross-deduction;
  
                                   BigDecimal bd = new BigDecimal(netpay).setScale(2, RoundingMode.HALF_EVEN);
                                   netpay = bd.doubleValue();
  
                                   String stringnetpay=Double.toString(netpay);
                                   txtNetpay.setText(stringnetpay);
  
                              }
                           }else {
                                  // error
                              }
                      }
  
                      });
  </code></pre>