쓸만한 주저리
[안드로이드 코틀린] Thread 안에서 UI(Toast 등) 호출
봄돌
2019. 6. 5. 09:54
반응형
Handler(Looper.getMainLooper()).post {
//Toast 호출
Toast.makeText(this, "표시할 내용", Toast.LENGTH_LONG).show()
//경고음 출력- 이것도 Thread 안에서 단순 호출로는 작동하지 않는다.
val toneGen1 = ToneGenerator(AudioManager.STREAM_MUSIC, 100)
toneGen1.startTone(ToneGenerator.TONE_CDMA_ABBR_ALERT, 300)
}
반응형