안드로이드 개발 질문/답변
(글 수 45,052)
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.spinnerchoice);
this.setTitle("Car Setting");
//Spinner01
s1 = (Spinner)findViewById(R.id.spinner1); //회사=현대, 기아, GM, SM
company_Spinners(); //현대, 기아, 삼섬, 대우
//Spinner02
s2 = (Spinner)findViewById(R.id.spinner2); //모델=소나타, 제네시스
company_Sub_spinners(R.array.company); //상위 spinner(회사)
s1.setOnItemSelectedListener(company_car); //spinner1 에 비교하겠다.
//Spinner03
s3 = (Spinner)findViewById(R.id.spinner3); //type=VCAN, HDCAN
car_type();
//Spinner04
s4 = (Spinner)findViewById(R.id.spinner4);
car_sub_type(R.array.hyundai_type);//hyundai_type = Vehicle CAN,Diagnostic CAN......보여짐->선택!
s3.setOnItemSelectedListener(car_sub_type);
s4.setOnItemSelectedListener(choice_type); <----- 이부분
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.spinnerchoice);
this.setTitle("Car Setting");
//Spinner01
s1 = (Spinner)findViewById(R.id.spinner1); //회사=현대, 기아, GM, SM
company_Spinners(); //현대, 기아, 삼섬, 대우
//Spinner02
s2 = (Spinner)findViewById(R.id.spinner2); //모델=소나타, 제네시스
company_Sub_spinners(R.array.company); //상위 spinner(회사)
s1.setOnItemSelectedListener(company_car); //spinner1 에 비교하겠다.
//Spinner03
s3 = (Spinner)findViewById(R.id.spinner3); //type=VCAN, HDCAN
car_type();
//Spinner04
s4 = (Spinner)findViewById(R.id.spinner4);
car_sub_type(R.array.hyundai_type);//hyundai_type = Vehicle CAN,Diagnostic CAN......보여짐->선택!
s3.setOnItemSelectedListener(car_sub_type);
s4.setOnItemSelectedListener(choice_type); <----- 이부분
}
위에 식을 보시면 알겠지만...이 소스에 액티비티가 호출되면서...
맨처음 onCreate 가 호출되게 되어있습니다....
위에서 부터 쭉 읽어오게 되어있는데요...
문제가 소스 아래쪽 s4.setOnItemSelectedListener(choice_type); <-------- 이부분
이 부분이 맨 처음에 실행될때는 안읽어져야하고,
그 후로는 활성화가 되어있어야하는 상황입니다...
자바 지식이 부족에서 이것저것 책을 찾아가며 해봤는데요...
잘안되네요;;
고수분들 조그마한 팁이라도 부탁드립니다ㅠㅠ