sql - Getting data from multiple cursors in Android ListView -
in project have 2 cursors. 1 handling books records form 1 table , join on 2 tables holding rents records , users data. using 2 cursors because join on showing books rented, , not all. i've figured out - if join , 1 of column empty omited in resulting cursor.
the proble want have in 1 listview
. i've created custom cursorloader
because data loading done via loader
. custom loader returning list of cursors based on list of elements - difference.
in cursoradapter
implementation want set text of textview
rent or free based on values second cursor.
unfortunately can't like: secondcursor.moveto(bookid)
because book id can way bigger size of secondcursor throw indexoutofboundsexception
.
also i've been testing cursorjoiner
:
cursorjoiner joiner = new cursorjoiner(data.get(0)/*first cursor*/, new string[]{tables.book_id}, data.get(1)/*second cursor*/, new string[]{tables.rent_column_book_id}); int = 0; while(joiner.hasnext()){ cursorjoiner.result result = joiner.next(); i++; switch(result){ case both: debuglog.i("both: " + i); case left: break; case right: break; default: break; } }
the problem isn't working iwould expect - value changed accordingly first cursor. after switching in cursorjoiner
constructor cursors order.
for short time i've been thinking using extednedcursor value in added column same, useless.
my question - know idea how can achieve goal?
i found answer question. guess should have started this. i've been using inner join
creating new table containing values in both tables. instead should have use outer join
joining records no matter what.
Comments
Post a Comment