The problem occurs on the line with rawQuery(

                ArrayList<Long> myIds = new ArrayList<Long>();
                        Cursor c = null;
                        try {
                                c = ((MyApplication) 
MyApplication.getApplication()).getDbHelper().getReadableDatabase().rawQuery(queryString,null);
                                if(c.moveToFirst()) {
                                        while(!c.isAfterLast()) {
                                                
myIds.add(c.getLong(c.getColumnIndex(MYID)));
                                                c.moveToNext();
                                        }
                                }
                        } finally {
                                if(null!=c)
                                        c.close();
                        }
                return myIds;

Thanks for any help.


On 29/07/2011, at 6:35 PM, KP wrote:

> Code will help.
> 
> On Jul 29, 11:16 am, Julius Spencer <jul...@msa.co.nz> wrote:
>> Hi,
>> 
>> I have been taking all my database reads off the main UI thread and have 
>> come across some new problems.
>> 
>> I'm receiving the following error(s):
>> 
>> ERROR/CursorWindow(26242): CursorWindow heap allocation failed
>> 
>> followed by:
>> 
>> ERROR/AndroidRuntime(26242): java.lang.RuntimeException: An error occured 
>> while executing doInBackground()
>> ERROR/AndroidRuntime(26242):     at 
>> android.os.AsyncTask$3.done(AsyncTask.java:200)
>> ERROR/AndroidRuntime(26242):     at 
>> java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
>> ERROR/AndroidRuntime(26242):     at 
>> java.util.concurrent.FutureTask.setException(FutureTask.java:125)
>> ERROR/AndroidRuntime(26242):     at 
>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
>> ERROR/AndroidRuntime(26242):     at 
>> java.util.concurrent.FutureTask.run(FutureTask.java:138)
>> ERROR/AndroidRuntime(26242):     at 
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
>> ERROR/AndroidRuntime(26242):     at 
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
>> ERROR/AndroidRuntime(26242):     at java.lang.Thread.run(Thread.java:1019)
>> ERROR/AndroidRuntime(26242): Caused by: java.lang.IllegalStateException: 
>> Couldn't init cursor window
>> ERROR/AndroidRuntime(26242):     at 
>> android.database.CursorWindow.native_init(Native Method)
>> ERROR/AndroidRuntime(26242):     at 
>> android.database.CursorWindow.<init>(CursorWindow.java:41)
>> ERROR/AndroidRuntime(26242):     at 
>> android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:276)
>> ERROR/AndroidRuntime(26242):     at 
>> android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:268)
>> ERROR/AndroidRuntime(26242):     at 
>> android.database.AbstractCursor.moveToPosition(AbstractCursor.java:171)
>> ERROR/AndroidRuntime(26242):     at 
>> android.database.AbstractCursor.moveToFirst(AbstractCursor.java:248)
>> 
>> I can't seem to find much online about this and don't know what it really 
>> means.
>> 
>> Regards,
>> Julius.
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to