Задать вопрос
Chvalov
@Chvalov

Есть ли более правильный способ работать с элементами Android?

Есть ли более компактный вариант написания, вод такого кода:
public class ActivitySettings extends AppCompatActivity{

    TextView TV_CP30_PhaseA, TV_CP30_PhaseB, TV_CP30_PhaseC, TV_BC_PhaseA, TV_BC_PhaseB, TV_BC_PhaseC, TV_UUZ_PhaseA, TV_UUZ_PhaseB,
            TV_UUZ_PhaseC,TV_PZS_PhaseA, TV_PZS_PhaseB, TV_PZS_PhaseC, TV_ZOA_PhaseA, TV_ZOA_PhaseB, TV_ZOA_PhaseC, TV_ZRK_PhaseA,
            TV_ZRK_PhaseB, TV_ZRK_PhaseC,TV_VS13_PhaseA, TV_VS13_PhaseB, TV_VS13_PhaseC, TV_VS46_PhaseA, TV_VS46_PhaseB,
            TV_VS46_PhaseC, TV_ZOM_PhaseA, TV_ZOM_PhaseB, TV_ZOM_PhaseC;
    EditText ET_CP30_SensorType, ET_BC_SensorType, ET_UUZ_SensorType, ET_PZS_SensorType, ET_ZOA_SensorType, ET_ZRK_SensorType,
            ET_VS13_SensorType, ET_VS46_SensorType, ET_ZOM_SensorType, ET_CP30_Inom, ET_BC_Inom, ET_UUZ_Inom, ET_PZS_Inom,
            ET_ZOA_Inom, ET_ZRK_Inom, ET_VS13_Inom, ET_VS46_Inom, ET_ZOM_Inom;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        ET_CP30_SensorType = (EditText) findViewById(R.id.ET_CP30_SensorType);
        ET_BC_SensorType = (EditText) findViewById(R.id.ET_BC_SensorType);
        ET_UUZ_SensorType = (EditText) findViewById(R.id.ET_UUZ_SensorType);
        ET_PZS_SensorType = (EditText) findViewById(R.id.ET_PZS_SensorType);
        ET_ZOA_SensorType = (EditText) findViewById(R.id.ET_ZOA_SensorType);
        ET_ZRK_SensorType = (EditText) findViewById(R.id.ET_ZRK_SensorType);
        ET_VS13_SensorType = (EditText) findViewById(R.id.ET_VS13_SensorType);
        ET_VS46_SensorType = (EditText) findViewById(R.id.ET_VS46_SensorType);
        ET_ZOM_SensorType = (EditText) findViewById(R.id.ET_ZOM_SensorType);
        ET_CP30_Inom = (EditText) findViewById(R.id.ET_CP30_Inom);
        ET_BC_Inom = (EditText) findViewById(R.id.ET_BC_Inom);
        ET_UUZ_Inom = (EditText) findViewById(R.id.ET_UUZ_Inom);
        ET_PZS_Inom = (EditText) findViewById(R.id.ET_PZS_Inom);
        ET_ZOA_Inom = (EditText) findViewById(R.id.ET_ZOA_Inom);
        ET_ZRK_Inom = (EditText) findViewById(R.id.ET_ZRK_Inom);
        ET_VS13_Inom = (EditText) findViewById(R.id.ET_VS13_Inom);
        ET_VS46_Inom = (EditText) findViewById(R.id.ET_VS46_Inom);
        ET_ZOM_Inom = (EditText) findViewById(R.id.ET_ZOM_Inom);
        TV_CP30_PhaseA = (TextView) findViewById(R.id.TV_CP30_PhaseA);
        TV_CP30_PhaseB = (TextView) findViewById(R.id.TV_CP30_PhaseB);
        TV_CP30_PhaseC = (TextView) findViewById(R.id.TV_CP30_PhaseC);
        TV_BC_PhaseA = (TextView) findViewById(R.id.TV_BC_PhaseA);
        TV_BC_PhaseB = (TextView) findViewById(R.id.TV_BC_PhaseB);
        TV_BC_PhaseC = (TextView) findViewById(R.id.TV_BC_PhaseC);
        TV_UUZ_PhaseA = (TextView) findViewById(R.id.TV_UUZ_PhaseA);
        TV_UUZ_PhaseB = (TextView) findViewById(R.id.TV_UUZ_PhaseB);
        TV_UUZ_PhaseC = (TextView) findViewById(R.id.TV_UUZ_PhaseC);
        TV_PZS_PhaseA = (TextView) findViewById(R.id.TV_PZS_PhaseA);
        TV_PZS_PhaseB = (TextView) findViewById(R.id.TV_PZS_PhaseB);
        TV_PZS_PhaseC = (TextView) findViewById(R.id.TV_PZS_PhaseC);
        TV_ZOA_PhaseA = (TextView) findViewById(R.id.TV_ZOA_PhaseA);
        TV_ZOA_PhaseB = (TextView) findViewById(R.id.TV_ZOA_PhaseB);
        TV_ZOA_PhaseC = (TextView) findViewById(R.id.TV_ZOA_PhaseC);
        TV_ZRK_PhaseA = (TextView) findViewById(R.id.TV_ZRK_PhaseA);
        TV_ZRK_PhaseB = (TextView) findViewById(R.id.TV_ZRK_PhaseB);
        TV_ZRK_PhaseC = (TextView) findViewById(R.id.TV_ZRK_PhaseC);
        TV_VS13_PhaseA = (TextView) findViewById(R.id.TV_VS13_PhaseA);
        TV_VS13_PhaseB = (TextView) findViewById(R.id.TV_VS13_PhaseB);
        TV_VS13_PhaseC = (TextView) findViewById(R.id.TV_VS13_PhaseC);
        TV_VS46_PhaseA = (TextView) findViewById(R.id.TV_VS46_PhaseA);
        TV_VS46_PhaseB = (TextView) findViewById(R.id.TV_VS46_PhaseB);
        TV_VS46_PhaseC = (TextView) findViewById(R.id.TV_VS46_PhaseC);
        TV_ZOM_PhaseA = (TextView) findViewById(R.id.TV_ZOM_PhaseA);
        TV_ZOM_PhaseB = (TextView) findViewById(R.id.TV_ZOM_PhaseB);
        TV_ZOM_PhaseC = (TextView) findViewById(R.id.TV_ZOM_PhaseC);
        
        setContentView(R.layout.activity_settings);
    }
}
  • Вопрос задан
  • 157 просмотров
Подписаться 2 Оценить 1 комментарий
Пригласить эксперта
Ответы на вопрос 1
@onepavel
Консультация и разработка мобильных приложений
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы