gpt4 book ai didi

java - 光标窗口 : Window is full

转载 作者:行者123 更新时间:2023-11-30 10:48:33 25 4
gpt4 key购买 nike

我是新手,几天后,也许我发现我有这个问题,我在一个大 listView 中有一个非常大的数据

W/CursorWindow:窗口已满:请求分配 1432389 字节,可用空间 750700 字节,窗口大小 2097152 字节

E/CursorWindow:无法从具有 0 行 64 列的 CursorWindow 读取第 0 行,第 0 列。

W/dalvikvm: threadid=1: 线程退出并出现未捕获的异常 (group=0x420aeda0)
03-03 15:50:00.162 16239-16239/id.co.bumisentosa.yantek E/AndroidRuntime:致命异常:主要
java.lang.IllegalStateException:无法从 CursorWindow 读取第 0 行,第 0 列。在访问 Cursor 中的数据之前,确保 Cursor 已正确初始化。

我读过一些相同的问题 android java.lang.IllegalStateException: Couldn't read row 0, col 0 from CursorWindow

我发现我的问题是我在 blob(字节)中的图像不会加载到我的 listView 中。

然后如何解决我的 cameraIntent 并将其保存到特定文件夹,然后将其放入数据库并加载到 ListView 中。我真的需要你的帮助和例子。谢谢你

我用的是这样的

 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;
}

保存到数据库

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);

}

我的数据库

 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();

}

最佳答案

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.

简而言之,你不能。虽然您可以将图像存储在数据库中,但您无法从数据库中检索它,因为它太大而无法放入限制为 2MB (2097152) 的 CursorWindow 中。

图像本身大约有 1432389 字节,但 CursorWindow 只有 750700 字节。因此,由于 1432389 大于 750700 图像(blob),因此无法提取。

如果您满足以下条件,则可以解决此问题:-

save it to a specific folder, then
save the path (or part of the path) in the database rather than the image, and then
extract the path and then get the image via the path when loading the ListView.

关于java - 光标窗口 : Window is full,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35766836/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com