title: While loop stack overflow
body: <p>I use this method, and i get the while loop stack overflow.
  No error message or crash. I got this in my log cat:</p>
  
  <pre><code>05-18 20:17:16.528: W/InputEventReceiver(19831): Attempted to finish an input event but the input event receiver has already been disposed.
  </code></pre>
  
  <p>When i put this code in my while boolean:</p>
  
  <pre><code>data.numberOfSameDateRows(selectedDay) != 0
  </code></pre>
  
  <p>the loop is fine.
  But when i use it like below i got stack overflow.</p>
  
  <pre><code>if(data.numberOfSameDateRows(selectedDay) != 0)
                  i=0;
              else
                  i++;
  </code></pre>
  
  <p>Thank for helping :)</p>
  
  <p>Here is my code:</p>
  
  <pre><code>DataBaseMain data = new DataBaseMain(this);
      data.open();
  
      SimpleDateFormat dateFormatter = new SimpleDateFormat("d-MMMM-yyyy");
      String dateWanted = getCorrectDate(removeSpinner);
  
      Date wantedDate = new Date();
      int i = 0;
  
      try {
          wantedDate = dateFormatter.parse(dateWanted);
          } catch (ParseException e) {
              e.printStackTrace();
      }
  
      Calendar myCal = new GregorianCalendar();
      myCal.setTime(wantedDate);
      Date newDate = myCal.getTime(); 
      String selectedDay = dateFormatter.format(newDate);
  
      if(dateWanted.equals("all") == false){  
  
      do{ 
      if(data.numberOfSameDateRows(selectedDay) != 0)
              i=0;
          else
              i++;
  
      myCal.add(Calendar.DAY_OF_YEAR, 7);     
      newDate = myCal.getTime();  
      selectedDay = dateFormatter.format(newDate);
  
      }
      while(i &lt; 5);
  
  
  public int numberOfSameDateRows(String date){
  
          int i = 0;
          String[] columns = new String[]{COLUMN_DATE};
          Cursor c = ourDatabase.query(TABLE_NAME, columns, COLUMN_DATE + "= '" + date + "'", null, null, null, null);
  
      if(c.getCount() &gt;= 1)
          for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()){
              i++;
          }   
  
      return i;   
      }
  </code></pre>