if I have this method in a jar library:
public void playAudioFile()
ClassLoader cLoader = getClass().getClassLoader();
URL url = cLoader.getResource("audio.mp3"); // in the resource of the jar library
MediaPlayer mediaPlayer = new MediaPlayer();
After compiling the library, I have: MySDK.jar
When I add the MySDK.jar into my android application and try to play an audio file:
private void playAudio()
MySDK.Audio audio = new MySDK.Audio();
After compiling the android application, I have: mysampleapp.apk
When debugging the application, the audio file can't be played because:
The path of the audio should be from the jar file not from the sample app. Therefore, the audio file can not be played.
What did I do wrong and how can I play an audio file as a resource file from the jar library?
Thanks in advance.