1 / 7

10.2. Audio with SD Card

10.2. Audio with SD Card. Prof. Oum Saokosal Master of Engineering in Information Systems, South Korea 855-12-252-752 oum_saokosal@yahoo.com. Upload to SD Card of the Emulator.

nuncio
Download Presentation

10.2. Audio with SD Card

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  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: • Go to AVD Manager (Window -> AVD Manager) • Click on your avd (e.g.avd.2.3.3) -> Edit • Enter a size: 1000 for the SD Card • Click Enter AVD to finish.

  4. II. Upload a file to SD Card: Go to DDMS -> File Explorer In case you can't see the file, please run the Emulator first. Browse to mnt/sdcard 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

More Related