public List<Diagnosis_tble> GetAllPatientDetails()
{
List<Diagnosis_tble> DiagnosistblList = new ArrayList<Diagnosis_tble>();
String selectQuery = "SELECT * FROM " + TABLE_Diagnosistble + "";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = null;
{
cursor = db.rawQuery(selectQuery, null);
if(cursor.getCount() > 0)
{
if (cursor.moveToFirst())
do{
Diagnosis_tble diagCreation_tble = new Diagnosis_tble();
diagCreation_tble.SetDiagnosisID(cursor.getString(0));
diagCreation_tble.SetPName(cursor.getString(1));
diagCreation_tble.SetHospitalNo(cursor.getString(2));
diagCreation_tble.SetPGender(cursor.getString(3));
diagCreation_tble.SetPacemaker(cursor.getString(4));
diagCreation_tble.SetDiagType(cursor.getString(5));
diagCreation_tble.SetP_Age(cursor.getString(6));
diagCreation_tble.SetDeviceID(cursor.getString(7));
diagCreation_tble.SetDiagStrtTime(cursor.getString(8));
diagCreation_tble.SetDiagEndTime(cursor.getString(9));
diagCreation_tble.SetDiagStatus(cursor.getString(10));
diagCreation_tble.SetReportStatus(cursor.getString(11));
diagCreation_tble.SetUploadStatus(cursor.getString(12));
DiagnosistblList.add(diagCreation_tble);
}while (cursor.moveToNext());
return DiagnosistblList;
}else
{
return null;
}
}
finally
{
cursor.close();
}
}
what is wrong in this code?
I am getting this Exception:
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.abc.TestApp/com.abc.TestApp.LoadData}:
android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed.
I have faced the same trouble as you. What I did is I went all over my application data classes and close all other cursor objects which were not closed. so I guess same happen in your application also, open your data classes and find the cursors that didn't closed and close them
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With