Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- Activity
- firebase
- ROOM
- 안드로이드 스튜디오
- 코틀린
- Kotlin
- OutlinedButton
- 안드로이드스튜디오
- 뷰바인딩
- androidstudio
- textview
- BottomSheetDialog
- Imageview
- Dialog
- RealtimeDB
- ArrayList
- button
- lifecyclescope
- MaterialButton
- 밑줄
- ViewModel
- FRAGMENT
- nav_graph
- 팝업액티비티
- 랜덤ID
- ButtonWithButton
- Android
- 안드로이드
- firebasefunctions
- EditText
Archives
- Today
- Total
안드로이드 앱 개발
RadioGroup에 checkedChangeListener 달기 본문
RadioGroup rg = (RadioGroup)findViewById(R.id.radioGroup1);
final TextView tv = (TextView)findViewById(R.id.textView2);
rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
String result;
if(checkedId == R.id.radio3){
tv.setText("정답");
}else{
tv.setText("오답");
}
}
});
//코틀린버전
binding.radioGroup.setOnCheckedChangeListener(RadioGroup.OnCheckedChangeListener { group, checkedId ->
if (checkedId == binding.maleRb.id){
viewModel.gender = "남"
Log.d(TAG, "사장님 성별 : " + viewModel.gender)
} else {
viewModel.gender = "여"
Log.d(TAG, "사장님 성별 : " + viewModel.gender)
}
})