[android-developers] Re: SQLite, Cursors, CursorIndexOutOfBoundsException

2011-05-26 Thread adek
Thank you for your answer. Yes. I wasn't sure which way is better - using two cursors or using one cursor with Custom CursorAdapter (and curosr inside custom View in it). On May 26, 12:27 pm, Kostya Vasilyev wrote: > I already posted the basic pattern two messages back. > > As for nested data,

Re: [android-developers] Re: SQLite, Cursors, CursorIndexOutOfBoundsException

2011-05-26 Thread Kostya Vasilyev
I already posted the basic pattern two messages back. As for nested data, you might want to use CursorAdapter (with subclassing) instead of trying to fit nested queries to SimpleCursorAdapter, which is more trouble than it's worth. If you do, you won't need to iterate through the top-level query

Re: [android-developers] Re: SQLite, Cursors, CursorIndexOutOfBoundsException

2011-05-26 Thread Adrian Kajda
Can you give me a link with an example of that? 2011/5/26 Kostya Vasilyev > You can use the pattern for the top level and the nested query both. > > -- Kostya > 2011/5/26 adek > >> I tried to change my code this way. There is still a problem. >> >> I tried to check for empty rows but even then

Re: [android-developers] Re: SQLite, Cursors, CursorIndexOutOfBoundsException

2011-05-26 Thread Kostya Vasilyev
You can use the pattern for the top level and the nested query both. -- Kostya 2011/5/26 adek > I tried to change my code this way. There is still a problem. > > I tried to check for empty rows but even then I've got this exception > error. > > Maybe the problem is in my way of dealing with thos

[android-developers] Re: SQLite, Cursors, CursorIndexOutOfBoundsException

2011-05-26 Thread adek
I tried to change my code this way. There is still a problem. I tried to check for empty rows but even then I've got this exception error. Maybe the problem is in my way of dealing with those two cursors (second cursor is in another) Maybe I'll start from the beggining and you will tell me a bet

[android-developers] Re: SQLite, Cursors, CursorIndexOutOfBoundsException

2011-05-26 Thread adek
I tried to change my code this way. There is still a problem. I tried to check for empty rows but even then I've got this exception error. Maybe the problem is in my way of dealing with those two cursors (second cursor is in another) On May 26, 10:18 am, Kostya Vasilyev wrote: > A cursor's init

Re: [android-developers] Re: SQLite, Cursors, CursorIndexOutOfBoundsException

2011-05-26 Thread Kostya Vasilyev
A cursor's initial position is -1, right before the first row, so it's quite enough to do this: Cursor cursor = . query ... if (cursor != null) { ... get column indices here while (cursor.moveToNext()) { ... get data using the indices here ... } cursor.close(); }

Re: [android-developers] Re: SQLite, Cursors, CursorIndexOutOfBoundsException

2011-05-26 Thread Nikolay Elenkov
On Thu, May 26, 2011 at 4:59 PM, Senthil ACS wrote: > > Hi, > > After you get a cursor object from a query, check the count before > doing "moveToFirst()". > moveToFirst() will not fail, just return false if empty. Just check the return value before proceeding. -- You received this message beca

[android-developers] Re: SQLite, Cursors, CursorIndexOutOfBoundsException

2011-05-26 Thread adek
Thanks. But this is strange. When I add this condition if(cursor.getCount() > 0) } ... My ListView is empty. In LogCat everything looks fine. On May 26, 9:59 am, Senthil ACS wrote: > Hi, > > After you get a cursor object from a query, check the count before > doing "moveToFirst()". > > if(cur

[android-developers] Re: SQLite, Cursors, CursorIndexOutOfBoundsException

2011-05-26 Thread Senthil ACS
Hi, After you get a cursor object from a query, check the count before doing "moveToFirst()". if(cursor.getCount() > 0) { cursor.moveToFirst(); ... processing ... } On May 26, 3:12 am, adek wrote: > Hello, > > As a beginner in android java world I need your help. I've got problem > with