title: Android CursorWindowAllocationException
body: <p>I'm getting this error :</p>
  
  <pre><code>E/AndroidRuntime(8223): Caused by: android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed. # Open Cursors=940 (# cursors opened by this proc=940)
  </code></pre>
  
  <p>I know its probably because I'm using the Cursor in a wrong way or not closing it at the right time. I think it could be because I'm filling the same cursor without closing/emptying it?</p>
  
  <pre><code>public static void NextAlarmTxt(){
          int dan = c.get(Calendar.DAY_OF_WEEK);
          long trenutnovrijeme = c.getTimeInMillis();
          long bazavrijeme;
          long pamti = 0;
          String danString = dani(dan);       
          Cursor CursorDan = DatabaseManager.getAllDataDay(danString);
  
  
          CursorDan.moveToFirst();
          if (!CursorDan.isAfterLast())
          {
              do
              {
                  bazavrijeme = CursorDan.getInt(2);
  
                  if (trenutnovrijeme&lt;bazavrijeme)
                  {
                      if (pamti==0)
                      {
                          pamti = bazavrijeme;
                      }
  
                      if (pamti&gt;0)
                      {
                      if (pamti &gt; bazavrijeme)
                      {
                          pamti = bazavrijeme;
                      }
                      }                   
                  }
                  if (trenutnovrijeme &gt; bazavrijeme)
                  {
                      dan = dan+1;
                      dani(dan);
                      CursorDan = DatabaseManager.getAllDataDay(danString);
                  }
              }
              while (CursorDan.moveToNext());         
          }               
          CursorDan.close();
          text1.setText(new StringBuilder("Sljedeći : " ).append(pamti).toString());
      }       
      public static String dani(int dan){
  
      String danString = null;
  
          if (dan==1)
          {
          danString = "Nedjelja";
          }
          else if (dan==2)
          {
              danString = "Ponedjeljak";
          }
          else if (dan==3)
          {
              danString = "Utorak";
          }
          else if (dan==4)
          {
              danString = "Srijeda";
          }
          else if (dan==5)
          {
              danString = "Četvrtak";
          }
          else if (dan==6)
          {
              danString = "Petak";
          }
          else if (dan==7)
          {
              danString = "Subota";
          }
          return danString;
      }
  </code></pre>