Thank you for the answer.
So Android handles Media files different from other files. If you want
to open other type of files, you don't need to give path.
Thanks!
April
On Aug 18, 3:27 am, hackbod <[EMAIL PROTECTED]> wrote:
> One thing to look at:
>
> mp.setDataSource("piano.mp3");
>
> This is using a relative path; the current directory of all processes
> is "/", so it is obviously not going to find your mp3 there. You need
> to always use an absolute path.
>
> On Aug 17, 5:34 pm, april <[EMAIL PROTECTED]> wrote:
>
> > Following code, if I use resouse bundle, It works.
>
> > However, I change the audio source to local file, I got IOException. I
> > have checked that the file is located correctly in the phone /data/
> > data/myapplication/files/piano.mp3.
>
> > What is the problem? Can android play mp3 from local files?
>
> > private void playAudio()
> > {
> > try
> > {
> > mp=new MediaPlayer();
> > mp.setDataSource("piano.mp3");
> > mp.reset();
> > mp.prepare();
> > mp.start();
> > }
> > catch(Exception e)
> > {
> > String a= e.toString();
> > String b =a+"sasa";
> > }
> > }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---