|
[android-beginners] Re: numeric datatype in sqlite, and display problem.: msg#01170AndroidBeginners
JUN wrote: > ... > Cursor c = ppp.getAll(); > > String[] from = new String[] {"name","gender","income"}; > > int[] to = new int[] { R.id.text1,R.id.text2,R.id.text3}; > > SimpleCursorAdapter peoples = new SimpleCursorAdapter > (this,R.layout.money_row, c, from, to); > > setListAdapter(peoples ); > > Try to use SimpleCursorAdapter to display data, but a question. > > a field type is numeric. > when display it > the value is 2000.12345 will be display 2000.12, save it in database > field is 2000.1234 > the value is 1.1234567 will be display 1.12346, save it in database > field is 1.1234567 If you want more control over the display of the floating-point values, do not use the built-in binding logic of SimpleCursorAdapter. Either associate a ViewBinder with the adapter, or extend it and override setViewText(), or extend it and override bindView(). Since you have not demonstrated how you are putting data into the database, it is difficult to determine the source of your problem. It may be you are using float/Float where you need to be using double/Double. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need Android talent? Ask on HADO! http://wiki.andmob.org/hado --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@xxxxxxxxxxxxxxxx To unsubscribe from this group, send email to android-beginners-unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---
|
|
||||||||||||||||||||||||||
| News | Mail Home | sitemap | FAQ | advertise |