0

I've been trying to find a method of playing one raw mp3 file from a different app, but I can't access it, even if I have the URI of the mp3.

EDIT: So I was able to access the raw, but when I set mediaplayer to play the sound, there is nothing played.

Context mApk1Context = createPackageContext("com.example.museum",Context.CONTEXT_IGNORE_SECURITY);                              
Resources mApk1Resources = mApk1Context.getResources();
int ResID = mApk1Resources.getIdentifier("china", "raw","com.example.museum");                              
mp.create(mApk1Context,ResID);
mp.start();
  • one easy way would be to copy the file on the sdcard, but I assume this is not an option? – njzk2 May 30 '14 at 18:39
  • I would like it to be purely memory, since the app should ideally play the mp3 from the other's raw. – Dat_фрикаделька May 30 '14 at 18:40
  • possible duplicate of [Share raw resource between apk's](http://stackoverflow.com/questions/4201776/share-raw-resource-between-apks) – njzk2 May 30 '14 at 19:03
  • mp.create is wrong, should be `mp = MediaPlayer.create` (see http://stackoverflow.com/questions/18254870/play-a-sound-from-res-raw) – njzk2 May 30 '14 at 19:41

0 Answers0