Mark,

Thanks for your reply, I was able to get it working.

Here is what I did, with your ideas and also referencing
http://www.anddev.org/gtalk-t1450.html.
public class testListView extends ListActivity {
  ...
  private DecimalFormat myCustDecFormatter = new DecimalFormat
("########.00");
  ...
  ...
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState)  {
    ...
    ...
    ...
  }

private void fillData() {
    /* Get all of the rows from the database and create the item list
*/
    /* for mult accts, pass in acct name? */
    mEntryCursor = mDbHelper.fetchAllEntries();
    startManagingCursor(mEntryCursor);

    // Create an array to specify the fields we want to display in the
list (only TITLE)
    String[] from = new String[]
{myDbAdapter.KEY_NMBR,myDbAdapter.KEY_DATE,myDbAdapter.KEY_DESCR,myDbAdapter.KEY_AMT};

    // and an array of the fields we want to bind those fields to (in
this case just text1)
    int[] to = new int[]{R.id.txtnmbr, R.id.txtdate, R.id.txtdescr,
R.id.txtamt};

    // Now create a simple cursor adapter and set it to display
    setListAdapter(new SimpleCursorAdapter(this, R.layout.entryrow,
mEntryCursor, from, to) {
        @Override
        public void setViewText(TextView v, String text) {
          super.setViewText(v, convText(v, text));
        }

    });

  }

  private String convText(TextView v, String text) {
    switch (v.getId()) {
      case R.id.txtamt:
        double dblAmt;
        //dblAmt = Double.valueOf(text);
        dblAmt = mEntryCursor.getDouble(AMT_COLUMN);
        return myCustDecFormatter.format(dblAmt);
    }
      return text;
    }
...
...
...
}//end testListView


On Aug 5, 11:32 am, Mark Murphy <[email protected]> wrote:
> Jeff wrote:
> > Hello, I am creating a program as a learning experience.
>
> > The program keeps a running balance of individual decimal values.
>
> > What is displayed is the balance total, and below that is a list of
> > the individual entries.
>
> > The numbers are all double data type, and saved in the sqlite3
> > database as datatype "REAL NOT NULL".
>
> > When the list is displayed, the balance shows the value correctly,
> > without rounding or cutting off numbers.
>
> > However, the list item numbers get rounded, and as the numbers get
> > bigger, the decimals start getting cut off.
>
> > Any ideas?
>
> You are implicitly relying upon something like Float#toString() to
> display the numeric data.
>
> If you want control over the formatting, you will need to use something
> like setViewText() or a ViewBinder with your SimpleCursorAdapter.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android App Developer Training:http://commonsware.com/training.html
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to