我從數據庫中選擇數據。 數據在一列中,您必須轉換爲千克,我需要乘以一列的因子。英鎊欄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