No matter what I do, the following throws an error that one of the columns contained in cursor_counterparty does not exist. When I checked merge_cursor, I can find the column there, here is my code, what am I doing wrong?
cursor_invoices = Invoices.getInvoicesCursor(counterparty.getId()); Cursor cursor_counterparty = Counterparties .getCounterpartyCursor(counterparty.getId()); startManagingCursor(cursor_invoices); startManagingCursor(cursor_counterparty); MergeCursor merge_cursor = new MergeCursor(new Cursor[] { cursor_invoices, cursor_counterparty }); merge_cursor.moveToFirst(); int[] listview_columns = new int[] { R.id.textview_invoice_number, R.id.textview_counterparty_name, R.id.textview_amount, R.id.textview_account_name, R.id.textview_invoice_date, R.id.textview_date_paid }; String[] listview_fields = new String[] { App.INVOICENUMBER, App.COUNTERPARTYNAME, counterparty_amount_field, App.ACCOUNTNAME, App.INVOICEDATE, App.DATEPAID }; SimpleCursorAdapter cursor_adapter_invoices = new SimpleCursorAdapter( this, R.layout.listview_invoice_item, merge_cursor, listview_fields, listview_columns);
The error I am getting is:
java.lang.IllegalArgumentException: column 'counterparty_name' does not exist
When I debug the application, I see "counterparty_name" as a column in one of the cursors in merge_cursor.
Any help would be great, thanks!
source share