Reputation: 31
I need to define array of RAW Resources by using kotlin for example
var x = ArrayList<Resources >
x.add(R.raw.cat)
and the other question is to pass resource to function
fun myFun(res:Resources ){
mp=MediaPlayer()
mp.start(res)
}
I will be very thanksfull for help
Upvotes: 1
Views: 902
Reputation: 482
You maybe need a Int
instead of Resources
to reference a resource id:
var x = ArrayList<Int>
x.add(R.raw.cat)
fun myFun(resId: Int) {
mp=MediaPlayer()
mp.start(resId)
}
Upvotes: 1