android - Odd Cursor Behavior -


i'm developing application uses database / contentprovider provide location data that's pulled network , stored locally in database periodically.

i've verified database created correctly in application, , tables populated data exporting copy of app local database sd card viewing in sql browser -- data not being present not issue here.

the odd behavior better visualized through couple of screen shots of debugging process:

so, when did queries, of cursor objects returning -1 row count, though verified select * table_name statement should return values, since database pulled off of device contains row data. here's @ debugger step:

enter image description here

notice when cursor returned, mcount displays -1.

out of curiosity, added cursor.movetofirst(); call, , here's screenshot after step:

enter image description here

notice cursor count changed -1 3, corresponds correct number of rows (since application accounts 3 continents atm). unfortunately, added line should unnecessary still doesn't fix problem, since cursoradapter.bindview() , cursoradapter.newview() still fail called resulting cursor.

i'm confused causing issue, , how fix it? if give insight problem be, please let me know. also, if additional code needed, such sql create statements, etc let me know - however, i've mentioned database created fine , queries performed on exported db copy outside of android application work fine...

one last thing, application built api levels 14+.

if have sql query reading database want delay reading data until use it.

so when call rawquery reference cursor object. nothing read yet. themovetofirst does. first thing tells cursor serious running sql query , want result.

but since using rawquery nothing passed on database before try fetch result movetofirst.

hope answers question.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -