가능하면 코드는 이미지 대신에 코드 에디터를 통해 올리시면 좋을 것 같아요. copy & paste를 할 수가 없어서...
MediaPlayer.create 함수는 AlramType을 호출할 수있도록 정의되어 있지 않아요. 님이 사용하신 팩토리 함수의 정의를 보면, 아래와 같이 되어 있어요. 두번째 파라미터는 Resource의 ID예요.
public static MediaPlayer create (Context context,
int resid)
// context Context: the Context to use
// resid int: the raw resource id (R.raw.<something>) for the resource to use as the datasource
따라서 AlramType의 속성인 rawId를 넘기셔야 해요.
val alarmType = intent?.getSerializalbleExtra("alaramType") ?: throw IllegalArgumentException("AlaramType이 정의되어 있지 않습니다.");
...
if (....) {
this.mdediaPlayer = MediaPlayer.create(this, alarmType.rawId)
...
}
그리고 최대한 변수는 var를 사용하지 마세고 val타입을 사용하세요. val가 읽기전용이라 더 안전하고, 성능상으로도 살짝 이점이 있을 수 있습니다.