This is just copying the file.
The question remains if you can play it or not... :=)

I have not looked into this at all, but DRM could prevent the mp3 from
playing.

On Mar 31, 9:55 am, iDeveloper <ideveloper...@gmail.com> wrote:
> Thanks a ton. Didn't know android allowed saving to mp3 directly  
> unlike an iphone.
>
> On 31-Mar-09, at 5:32 PM, MrChaz wrote:
>
>
>
>
>
> > Sure,
> > Something like
>
> > //Where the file comes from
> > URL sourceURL = new URL("address");
> > URLConnection conn = sourceURL.openConnection();
>
> > InputStream inStream = sourceURL.openStream();
>
> > // Where the file is going to go
> > FileOutputStream outStream= new FileOutputStream("sdcard/file.mp3");
>
> > //a read buffer
> > byte[] bytes = new byte[20480];
>
> > //read the first chunk
> > int readBytes = file.read(bytes);
>
> > //read the rest
> > while (readBytes > 0){
> > //Write the buffered chunk to the file
> > outStream.write(bytes, 0, readBytes);
> > readBytes = file.read(bytes);
> > }
> > inStream.close();
> > outStream.close();
>
> > should do it.  I've typed that more or less by hand so it's missing
> > error checking etc.
>
> > On Mar 31, 8:10 am, idev <ideveloper...@gmail.com> wrote:
> >> Hi
>
> >> I am able to stream an mp3 at real time on my android phone. I wanted
> >> to know if it is possible to save an mp3 file residing on a remote
> >> location to my SD card.
>
> >> Any heads up is greatly appreciated.
>
> >> Thanks.- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to