Presentation is loading. Please wait.

Presentation is loading. Please wait.

10.2. Audio with SD Card Prof. Oum Saokosal Master of Engineering in Information Systems, South Korea 855-12-252-752

Similar presentations


Presentation on theme: "10.2. Audio with SD Card Prof. Oum Saokosal Master of Engineering in Information Systems, South Korea 855-12-252-752"— Presentation transcript:

1 10.2. Audio with SD Card Prof. Oum Saokosal Master of Engineering in Information Systems, South Korea

2 Upload to SD Card of the Emulator Normally when you run the app on an Android device, you will need to play a song from the sdcard of the device. To place the song to the sdcard, simply copy it and paste. However, to test it on the Emulator, you need to push the file to the the Emulator. See how-to in the next slide.

3 I. Create size for sdcard: 1.Go to AVD Manager (Window -> AVD Manager) 2.Click on your avd (e.g.avd.2.3.3) -> Edit 3.Enter a size: 1000 for the SD Card 4.Click Enter AVD to finish.

4 II. Upload a file to SD Card: 1.Go to DDMS -> File Explorer 2.In case you can't see the file, please run the Emulator first. 3.Browse to mnt/sdcard 4.Click on the button call "Push a file onto the device" to upload.

5 Play a Song from SD Card To play an embedded song: MediaPlayer mp; mp = MediaPlayer.create(this, R.raw.song1)); To play a song from SD Card: MediaPlayer mp; mp = MediaPlayer.create(this, Uri.parse("/sdcard/More Than I Can Say.mp3"));

6 To Play with setDataSource() method: MediaPlayer mp; mp = new MediaPlayer(); try{ mp.reset(); mp.setDataSource("/sdcard/I love you.mp3"); mp.prepare(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } mp.start();

7 Go on to the next slide


Download ppt "10.2. Audio with SD Card Prof. Oum Saokosal Master of Engineering in Information Systems, South Korea 855-12-252-752"

Similar presentations


Ads by Google