Intent에 어떤 버튼이 눌렸는지 알 수 있는 데이터를 넘기면 되지 않을 까요?
예들 들면, 다음과 같이 enum을 사용해서
enum class AlarmType(val rawId: Int) {
RAINING(R.raw.raining),
...
}
fun startAlaramService(alarmType: AlarmType) {
val intent = Intent( this , AlarmService:: class .java)
intent.putSerialzable( "alaramType" , alarmType)
startService(intent)
}
|
버튼에 따라 다른 AlramType을 넘겨주시면 되지 않을까요?