My application lists transactions using a custom made list layout.
Below is the code I used to set the list adapter. Now how do I change
the contents of the adapter based on condition dynamically ?
Like for example, if the transaction type is credit I want the
textview used to display the Amount to be in GREEN color and RED for a
debit transaction ... And also how to change the way the data is shown
to the user, ie to edit the values obtained from the database and
modify it and show it to the user ?? I want to make it look like the
default CALL LOG, ie have different icons based on different
conditions??  I dont know how to do it and also if the user clicks a
list item it is taken to a View Page.
Please guide me.

Cursor transactionsCursor = mDbHelper.fetchAllTransactions();
        startManagingCursor(transactionsCursor);

                String[] from = new String[]
{LedgerDbAdapter.KEY_TRANSACTION_SHORTDESC,LedgerDbAdapter.KEY_TRANSACTION_DATETIME,LedgerDbAdapter.KEY_TRANSACTION_AMOUNT,LedgerDbAdapter.KEY_TRANSACTION_WITH};

        int[] to = new int[]
{R.id.listShortDesc,R.id.listDateTime,R.id.listAmount,R.id.listTransactionWith};

        // Now create a simple cursor adapter and set it to display
        SimpleCursorAdapter transactions =
                    new SimpleCursorAdapter(this, R.layout.rows,
transactionsCursor, from, to);
        setListAdapter(transactions);

--~--~---------~--~----~------------~-------~--~----~
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