"Причесать" инициализацию объектов.
Добавлено: 24 мар 2015, 20:13
Как можно организовать инициализацию объектов, когда их много?
Следующий код выглядит ужасно: '
Следующий код выглядит ужасно: '
Код: Выделить всё
b1 = (Button)findViewById(R.id.b1);
b2 = (Button)findViewById(R.id.b2);
b3 = (Button)findViewById(R.id.b3);
b4 = (Button)findViewById(R.id.b4);
b5 = (Button)findViewById(R.id.b5);
b6 = (Button)findViewById(R.id.b6);
b7 = (Button)findViewById(R.id.b7);
b8 = (Button)findViewById(R.id.b8);
b9 = (Button)findViewById(R.id.b9);
b10 = (Button)findViewById(R.id.b10);
text = (TextView) findViewById(R.id.text);
textView = (TextView) findViewById(R.id.textView);
b1.setOnClickListener(this);
b2.setOnClickListener(this);
b3.setOnClickListener(this);
b4.setOnClickListener(this);
b5.setOnClickListener(this);
b6.setOnClickListener(this);
b7.setOnClickListener(this);
b8.setOnClickListener(this);
b9.setOnClickListener(this);
b10.setOnClickListener(this);