title: CursorWindow: Window is full
body: <p>I'm new and after days, maybe I found that I have this issue, I have a very big data in a big listView </p>
  
  <p><code>W/CursorWindow: Window is full: requested allocation 1432389 bytes, free space 750700 bytes, window size 2097152 bytes</code></p>
  
  <p><code>E/CursorWindow: Failed to read row 0, column 0 from a CursorWindow which has 0 rows, 64 columns.</code></p>
  
  <p><code>W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x420aeda0)
  03-03 15:50:00.162 16239-16239/id.co.bumisentosa.yantek E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                                                                                    java.lang.IllegalStateException: Couldn't read row 0, col 0 from CursorWindow.  Make sure the Cursor is initialized correctly before accessing data from it.</code></p>
  
  <p>I have read some same issue
  <a href="https://stackoverflow.com/questions/21432556/android-java-lang-illegalstateexception-couldnt-read-row-0-col-0-from-cursorw">android java.lang.IllegalStateException: Couldn&#39;t read row 0, col 0 from CursorWindow</a></p>
  
  <p>And I found my issue is my image in blob (byte) will not load into my listView. </p>
  
  <p>Then how can I solve my cameraIntent and save it to a specific folder then put it in database and load it in ListView. I really need your help and by examples. Thank You</p>
  
  <p>What I was use is like this</p>
  
  <pre><code> public void openCamera(int resultCode) {
      Inspection_JTR_Fragment_Foto_Tab.gallery = false;
  
      File image = new File(appFolderCheckandCreate(resultCode), "img" + getTimeStamp()
              + ".jpg");
      Uri uriSavedImage = Uri.fromFile(image);
      id.co.bumisentosa.yantek.fragment_JTM.Inspection_JTM_Fragment_Foto_Tab.cameraImagePath = image.getAbsolutePath();
      Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
      i.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage);
      i.putExtra("return-data", true);
      startActivityForResult(i, resultCode);
  }
  
  
  
  
  
  private String appFolderCheckandCreate(int resultCode) {
  
      String appFolderPath = "";
      File externalStorage = Environment.getExternalStorageDirectory();
  
      switch (resultCode) {
          case 1:
              if (externalStorage.canWrite()) {
                  appFolderPath = externalStorage.getAbsolutePath() + "/yantek-babel-android/jtr/Keseluruhan Tiang";
                  File dir = new File(appFolderPath);
  
                  if (!dir.exists()) {
                      dir.mkdirs();
                  }
  
              } else {
  
              }
              break;
  
      }
      return appFolderPath;
  }
  </code></pre>
  
  <p>And save it to database</p>
  
  <pre><code>public boolean onOptionsItemSelected(MenuItem item) {
      final int id = item.getItemId();
      if (id == R.id.action_upload) {
          // Upload data ke server
  
         imageArray = Inspection_JTM_Fragment_Foto_Tab.getimageArray();
          imageArray_2 = Inspection_JTM_Fragment_Foto_Tab.getimageArray_2();
  
  
          databaseHandler.saveTest(new ItemsDetails(
  
  
                  imageArray,
                  imageArray_2
                  ));
  
      }
      return super.onOptionsItemSelected(item);
  
  }
  </code></pre>
  
  <p>my database</p>
  
  <pre><code> public String saveTest(ItemsDetails details) {
  
      try {
          SQLiteDatabase db = this.getWritableDatabase();
          ContentValues cv = new ContentValues();
          //  cv.put(KEY_ID, post.getId());
          //  cv.put(KEY_ID, "null");
  
          cv.put(COL_LOCATION_ID, details.getunitID());
          cv.put(COL_SECTION_ID, details.getjaringanID());
          cv.put(COL_INSPECTION_DATE, details.gettanggalInspeksi());
          cv.put(COL_INSPECTION_TYPE_ID, details.gettipeInspeksiID());
  
          cv.put(COL_PHOTO_ENTIRE_PATH, details.getimageArray());
          cv.put(COL_PHOTO_ISOLATOR_PATH, details.getimageArray_2());
  
          cv.put(COL_POLE_NO, details.getnoTiang());
          cv.put(COL_POLE_IRON, details.gettiangBesi());
          cv.put(COL_POLE_CONCRETE, details.gettiangBeton());
          cv.put(COL_POLE_WOOD, details.gettiangKayu());
  
          cv.put(COL_POLE_CONDITION_BROKEN, details.getkondisiTiangRetak());
          cv.put(COL_POLE_CONDITION_TILT, details.getkondisiTiangMiring());
          cv.put(COL_POLE_CONDITION_SHIFT, details.getkondisiTiangPindah());
  
          cv.put(COL_CROSS_ARM_TWIST, details.getcrossArmMelintir());
          cv.put(COL_CROSS_ARM_RUST, details.getcrossArmKarat());
          cv.put(COL_CROSS_ARM_TILT, details.getcrossArmMiring());
  
          cv.put(COL_ARM_TIE_REPAIR, details.getarmTiePerbaiki());
          cv.put(COL_ARM_TIE_RUST, details.getarmTieKarat());
          cv.put(COL_ARM_TIE_BRACE, details.getarmTiePasang());
  
          cv.put(COL_ISOLATOR_FULCRUM_R_LEAK, details.getisolatorTumpuRGompel());
          cv.put(COL_ISOLATOR_FULCRUM_R_BROKEN, details.getisolatorTumpuRPecah());
          cv.put(COL_ISOLATOR_FULCRUM_S_LEAK, details.getisolatorTumpuSGompel());
          cv.put(COL_ISOLATOR_FULCRUM_S_BROKEN, details.getisolatorTumpuSPecah());
          cv.put(COL_ISOLATOR_FULCRUM_T_LEAK, details.getisolatorTumpuTGompel());
          cv.put(COL_ISOLATOR_FULCRUM_T_BROKEN, details.getisolatorTumpuTPecah());
  
          cv.put(COL_ISOLATOR_PULL_R_LEAK, details.getisolatorTarikRGompel());
          cv.put(COL_ISOLATOR_PULL_R_BROKEN, details.getisolatorTarikRPecah());
          cv.put(COL_ISOLATOR_PULL_S_LEAK, details.getisolatorTarikSGompel());
          cv.put(COL_ISOLATOR_PULL_S_BROKEN, details.getisolatorTarikSPecah());
          cv.put(COL_ISOLATOR_PULL_T_LEAK, details.getisolatorTarikTGompel());
          cv.put(COL_ISOLATOR_PULL_T_BROKEN, details.getisolatorTarikTPecah());
  
          cv.put(COL_ARRESTER_R_BROKEN, details.getarresterRusakR());
          cv.put(COL_ARRESTER_S_BROKEN, details.getarresterRusakS());
          cv.put(COL_ARRESTER_T_BROKEN, details.getarresterRusakT());
  
          cv.put(COL_CONDUCTOR_R_BUYER, details.getkonduktorRBuyer());
          cv.put(COL_CONDUCTOR_R_LOOSE, details.getkonduktorRKendor());
          cv.put(COL_CONDUCTOR_S_BUYER, details.getkonduktorSBuyer());
          cv.put(COL_CONDUCTOR_S_LOOSE, details.getkonduktorSKendor());
          cv.put(COL_CONDUCTOR_T_BUYER, details.getkonduktorTBuyer());
          cv.put(COL_CONDUCTOR_T_LOOSE, details.getkonduktorTKendor());
  
          cv.put(COL_CONNECTOR_PG_R_35MM, details.getkonektorPGR35mm());
          cv.put(COL_CONNECTOR_PG_R_70MM, details.getkonektorPGR70mm());
          cv.put(COL_CONNECTOR_PG_R_150MM, details.getkonektorPGR150mm());
  
          cv.put(COL_CONNECTOR_PG_S_35MM, details.getkonektorPGS35mm());
          cv.put(COL_CONNECTOR_PG_S_70MM, details.getkonektorPGS70mm());
          cv.put(COL_CONNECTOR_PG_S_150MM, details.getkonektorPGS150mm());
  
          cv.put(COL_CONNECTOR_PG_T_35MM, details.getkonektorPGT35mm());
          cv.put(COL_CONNECTOR_PG_T_70MM, details.getkonektorPGT70mm());
          cv.put(COL_CONNECTOR_PG_T_150MM, details.getkonektorPGT150mm());
  
          cv.put(COL_BENDING_WIRE_R, details.getbendingWireR());
          cv.put(COL_BENDING_WIRE_S, details.getbendingWireS());
          cv.put(COL_BENDING_WIRE_T, details.getbendingWireT());
  
          cv.put(COL_ULTRASONIC_R, details.getultrasonicR());
          cv.put(COL_ULTRASONIC_S, details.getultrasonicS());
          cv.put(COL_ULTRASONIC_T, details.getultrasonicT());
  
          cv.put(COL_GSW_EXIST, details.getgswAda());
          cv.put(COL_GSW_NOT_EXIST, details.getgswTidakAda());
  
          cv.put(COL_TREE_EXIST, details.getpohonAda());
          cv.put(COL_TREE_NOT_EXIST, details.getpohonTidakAda());
  
          cv.put(COL_LONGITUDE, details.getlongitude());
          cv.put(COL_LATITUDE, details.getlatitude());
  
          cv.put(COL_SUGGESTION, details.getSaran());
          cv.put(COL_DESCR, details.getketerangan());
  
  
          db.insert(INSPECTIONS_MV_TABLE_NAME, null, cv);
      } catch (Exception e) {
          e.printStackTrace();
          return null;
      }
      return getNewTestID();
  
  }                                
  </code></pre>