我从数据库中选择数据。 数据在一列中,您必须转换为千克,我需要乘以一列的因子。英镑栏sets_weight
中的数据,并且必须以千克显示,而不需要修改数据库 如何正确执行。有任何想法吗!谢谢!如何乘以ListView中的数字,Android
onSets = db.getSets(exesIdsColExes, toprog_dif);
listSets.setAdapter(new SimpleCursorAdapter(this,
R.layout.itemsets, onSets,
new String[] {"sets_ids", "sets_weight", "sets_ones"},
new int[] {R.id.itemsets_ids, R.id.itemsets_weight, R.id.itemsets_ones}) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = super.getView(position, convertView, parent);
// Here we get the textview and set the color
Typeface fontTitleProg = Typeface.createFromAsset(getAssets(), "AGHELVETICA.TTF");
TextView itemsets_ids = (TextView) row.findViewById(R.id.itemsets_ids);
itemsets_ids.setTypeface(fontTitleProg, 1);
itemsets_ids.setGravity(0x05);
TextView itemsets_weight = (TextView) row.findViewById(R.id.itemsets_weight);
itemsets_weight.setTypeface(fontTitleProg, 1);
itemsets_weight.setGravity(0x01);
TextView itemsets_ones = (TextView) row.findViewById(R.id.itemsets_ones);
itemsets_ones.setTypeface(fontTitleProg, 1);
itemsets_ones.setGravity(0x01);
return row;
}
});
所以,你基本上想知道如何转换成千克后的列值乘以另一列中的值? – lokoko 2013-02-24 05:02:03
不,数据在英镑栏中sets_weight,有必要以千克显示,而不需要修改数据库 – Roman 2013-02-24 07:57:47