Make sure yoy are not reopening batabase after you've opened it.

On Aug 4, 1:19 am, Dev_red <[email protected]> wrote:
> Thank you very much.
>
> but i am getting this error..
>
> Finalizing a Cursor that has not been deactivated or closed.
> database = /data/data/com.android.myproject/databases/sampleDB, table
> = n
> ull, query = select * from TableName
> E/Cursor  (  863):
> android.database.sqlite.DatabaseObjectNotClosedException: App
> lication did not close the cursor or database object that was opened
> here
>
> On Aug 3, 5:59 pm, Vladimir Svydenko <[email protected]> wrote:
>
>
>
> > Hi,
> > If You close cursor inside this method - it will return null.
>
> > So, You do not need here closing cursor.
> > Here You can get data from cursor and then close it.
>
> > regards
>
> > On Aug 3, 2:56 pm,Dev_red<[email protected]> wrote:
>
> > > hi
>
> > > How to close cursor in following method? where i have to add
> > > cur.close()?
>
> > >      Cursor getData()
> > >          {
> > >                  SQLiteDatabase sdb=this.getWritableDatabase();
>
> > >                 Cursor cur = sdb.rawQuery("select * from " + 
> > > manpowerLUTable,null);
> > >                  if (cur != null)
> > >                  {
> > >                          cur.moveToFirst();
> > >                  }
> > >                  sdb.close();
> > >                 return cur;
> > >          }

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

Reply via email to