0
このコードを、例えば、をサイクルで10回繰り返すのではなく、 、D2 d2、...、D10 d10):アンドロイド:テキストエディットフィールドのフォーカスを失うサイクルを処理するため
//
// -------------- DIAMETRO 1 -----------------------------------
//
final EditText D1 = (EditText)findViewById(R.id.d1);
int d1 = mast.getInstance().getd1();
Log.d("Diametro 1 =", Integer.toString(d1));
D1.setText(Integer.toString(d1));
//
// Perdita del focus del diametro 1
//
D1.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
/* When focus is lost check that the text field
* has valid values.
*/
if (!hasFocus) {
String strD1=D1.getText().toString();
mast.getInstance().setd1(Integer.valueOf(strD1));
}
}
});
メソッドを作成し、その中のすべてのコードを移動することができます。 –