thanks for the reply i will try that thing

On Tue, Feb 10, 2009 at 11:15 PM, Dave Sparks <davidspa...@android.com>wrote:

>
> You can't "upload" your audio file into res/raw.
>
> You can place an audio file in the res/raw folder when you compile
> your code and aapt will compile it into the APK along with the code
> and other resources. You can then play it by using the MediaPlayer
> with code roughly like this:
>
> MediaPlayer mp = null;
> AssetFileDescriptor afd = context.getResources().openRawResourceFd
> (R.raw.my_audio_file);
> if (afd != null) {
>    mp = MediaPlayer.create();
>    try {
>        mp.setDataSource(afd.getFileDescriptor(), afd.getStartOffset
> (), afd.getLength());
>        mp.prepare();
>        mp.start();
>    } catch (java.io.IOException ex) {
>        mp.release();
>        mp = null;
>    }
> }
>
> // log an error for debugging purposes
> if (mp == null) {
>    Log.e("Error playing my_audio_file.mp3 from res/raw");
> }
>
> When you are done playing the file, make sure you call mp.release() to
> release the MediaPlayer resources.
>
> On Feb 10, 1:36 am, jaimin <jaiminmeht...@gmail.com> wrote:
> > hi.
> > i am new to android and i want devlop a mediaplayer so i want to
> > upload my audio file into my res/raw folder so how can i upload my
> > audio file into res/raw folder in my project .
> > anyone have any suggestion ?
> > plz give me suggestion i need it very badly .
> > thanks.
> > jaimin
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to