skatalicious
Lurker
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?
The xml for the textview:
[XML]<TextView android:id="@+id/txtamt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:gravity="right"
android:textSize="12px"
android:layout_marginRight="10px"/>
[/XML]
And the textview gets populated pulling the data from the database
like this:
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?
The xml for the textview:
[XML]<TextView android:id="@+id/txtamt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:gravity="right"
android:textSize="12px"
android:layout_marginRight="10px"/>
[/XML]
And the textview gets populated pulling the data from the database
like this:
Code:
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
SimpleCursorAdapter entries =
new SimpleCursorAdapter(this, R.layout.entryrow,
mEntryCursor, from, to);
setListAdapter(entries);
}