EditField[] ef = new EditField[size];//at global in class
//做一些事情
VerticalFieldManager vfm = new VerticalFieldManager();
for(int i=0 ;i<size ;i++)
{
HorizontalFieldManager hfm = new HorizontalFieldManager();
ef[i] = new EditField();
hfm.add(ef[i]);
vfm.add(hfm);
}
add(vfm);
//完成創建UI
//開始獲得價值從EditField中
public void fieldChanged(Field field, int context) {
super.fieldChanged(field, context);
for(int i=0;i<size;i++)
{
if (field.equals(ef[i]) {
system.out.println("Value from editfield :- " + ef[i].getText());
}
}
}
你可以舉一些子類的例子來實現唯一的id機制嗎? – Krish
當然,試試這個::(太長了,我會編輯回覆。 – Xiangdong