Problems with MediaPlayer, raw resources, stop and start

前端 未结 7 686
天命终不由人
天命终不由人 2020-12-25 12:37

I\'m new to Android development and I have a question/problem.

I\'m playing around with the MediaPlayer class to reproduce some sounds/music. I am playing raw resou

7条回答
  •  礼貌的吻别
    2020-12-25 13:07

    Or, you could access the resource in this way:

    mediaPlayer.setDataSource(context, Uri.parse("android.resource://com.package.name/raw/song"));
    

    where com.package.name is the name of your application package

提交回复
热议问题