this.mediaPlayer = MediaPlayer.create(this , alarmType)여기에 rawId 를 어떻게 넣으면 좋을까요
private fun fire() {
fire.setOnClickListener {
if (fire.isChecked) {
fire.setBackgroundDrawable(resources.getDrawable(R.drawable.clickable))
startAlarmService(AlarmService.AlarmType.FIRE) <-- 여기에서 잘못이 있는 걸 까요
} else
fire.setBackgroundDrawable(resources.getDrawable(R.drawable.day_button))
}
}
fun startAlarmService(alarmType: AlarmService.AlarmType) {
val intent = Intent(this, AlarmService::class.java)
intent.putExtra("alarmType", alarmType)
startService(intent)
}
enum class AlarmType(val rawId: Int) {
RAINNING(R.raw.rainning) , FIRE(R.raw.fire), FORSEST(R.raw.forest)
}
rawId를 어떻게 넘겨야 하는지 모르겠습니다