Conversation
| </activity> | ||
| <activity | ||
| android:name=".SecondActivity" | ||
| android:exported="true"> |
There was a problem hiding this comment.
외부에 노출될 필요가 없는 Activity는
exported="false" 로 해주세요.
| android:layout_width="80dp" | ||
| android:layout_height="35dp" | ||
| android:text="@string/message_button_random" | ||
| android:textSize="9dp" |
There was a problem hiding this comment.
textSize 는 sp 가 더 좋습니다.
sp 는 절대적 크기가 아닌 사용자 폰트 크기에 맞춰지거든요
There was a problem hiding this comment.
안드로이드에서 사용하는 길이 단위에 대해 알아보시면 좋을 것 같습니다
| val textView: TextView = findViewById(R.id.textView_main) | ||
| val randomButton: Button = findViewById(R.id.button_random) | ||
|
|
||
| val receivedRandomNumber = intent.getIntExtra("random_number", 0) |
There was a problem hiding this comment.
"random_number" 로 내부 str 선언이 아닌
const 변수로 하나의 객체를 참조해서 사용하는게 훨씬 안전합니다.
| insets | ||
| } | ||
|
|
||
| launcher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {} |
There was a problem hiding this comment.
과제에
d. 뒤로가기를 하면 첫번째 Activity으로 돌아오고, 화면의 숫자가 두번째 Activity의 숫자로 변경됩니다.
요건에 충족되지 않습니다.
SecondAcitivity 에서 setResult 까진 하셨는데 이 부분을 빼먹으셨네요.
|
|
||
| val randomButton: Button = findViewById(R.id.button_random) | ||
| randomButton.setOnClickListener { | ||
| val randomNumber = Random.nextInt(0, 15) |
There was a problem hiding this comment.
과제 조건에
C. Random 버튼을 누르면 랜덤한 숫자를 출력하는 두번째 Activity로 이동합니다.
0부터 첫번째 화면의 숫자 사이의 랜덤한 숫자가 출력됩니다.
요건에 충족되지 않았습니다.
Random.nextInt(0,15) 로 0~14 사이의 랜덤한 숫자가 아닌
Random.nextInt(0, textView.text.toInt()) 를 통해 random 범위를 정하셔야 합니다.
| v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom) | ||
| insets | ||
| } | ||
| Log.e("MYLOG","done3") |
There was a problem hiding this comment.
여기서 질문: Log.v, Log.d, Log.e의 차이는 무엇일까요
There was a problem hiding this comment.
Log.v는 비교적 세세하며 Log.d는 디버깅용 로그입니다 Log.e는 에러 로그입니다
| textView.text = receivedRandomNumber.toString() | ||
|
|
||
| randomButton.setOnClickListener { | ||
| val randomNumber = Random.nextInt(0, 15) |
There was a problem hiding this comment.
마찬가지 0,14 의 랜덤값이 아닙니다.
물론 랜덤 함수를 생성하는 버튼은 과제에 없어도 되는 요소입니다.
No description provided.