2011-04-14 128 views

回答

19
Uri path = Uri.parse("android.resource://[package]/[res id]"); 

例子:

Uri path = Uri.parse("android.resource://com.mypackage/"+R.raw.mysound_1); 
+0

唉唉。安靜簡單:) – 2011-04-14 14:39:28

2
Uri soundUri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.sound); 

添加到通知建設者

.setSound(soundUri) 
0

你很可能在尋找:

MediaPlayer mediaPlayer = MediaPlayer.create(context, R.raw.your_sound);