你好我是從千到石磅,我想放在一個EditText上的石頭和英鎊在一個EditText上轉換,下面是我的方法安卓:設置的EditText與arraylistvalue
public ArrayList<HashMap<String, Integer>> kiloTostomepound(int s) {
int stone = (int) (s * 2.2);
int stonevalue = stone/14;
int spound = (stone % 14);
arrayList = new ArrayList<HashMap<String,Integer>>();
HashMap<String, Integer> h1 = new HashMap<String, Integer>();
h1.put(STONE,stonevalue);
h1.put(STONEPOUND, spound);
arrayList.add(h1);
return arrayList;
}
我想要得到的值從arryalist並將其設置爲edittext。
做一個低於但givinf NullPointerException異常
edt2.setText(String.valueOf(kiloTostomepound(arrayList.get(0).get(STONE))));
edt3.setText(String.valueOf(kiloTostomepound(arrayList.get(1).get(STONEPOUND))));
你有多個edittext或單個嗎? –
@RemeesMSyde我有多個edittexts – teekib