can't read mp3 file from sdcard

by zeeshan » Thu, 05 Mar 2009 17:53:23 GMT


Sponsored Links
 Hi Mates,

i am trying to write mp3 file in OutputStreamWriter.

here is the code:

String fileName="/sdcard/test_cbr.mp3";

byte [] buffer = new byte[1024*4];
int bytesRead = 0;

FileInputStream is = new FileInputStream(fileName);

// everything fine untill here

while( (bytesRead = is.read(buffer)) > 0) { // while condition is
false
                    wr.write(buffer,0,bytesRead);
                    wr.flush();
                }


it can access the file and makes the FileInputStream object but cann't
read. it doesn't go in While loop

any solution?

Thanks

--~--~---------~--~----~------------~-------~--~----~



can't read mp3 file from sdcard

by zeeshan » Thu, 05 Mar 2009 19:52:59 GMT


 its working now!
actually it was read permission problem.



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Recommended way of passing callback context data between activities

Hi,

Quite often when I launch an Activity using startActivityForResult I 
need to store some context data that will be needed in my 
onActivityResult implementation. (e.g., a reference to some in memory 
data that will be modified after the child activity finishes). The data 
in question is transient by nature so it's not already stored in a db 
somewhere.


Up until now I was simply storing data in a field of the parent 
activity, however this isn't reliable as this wont survive a restart of 
the parent activity (e.g., when a config change happens).
In some of my code I've handled this by passing a PendingIntent (created 
using Activity#createPrendingResult) to the child activity where I 
stored all the context data in the intent extras. This works for my own 
code, but is not generally usable since most of the platform provided 
activities don't support this way of working.
The only other alternative I've been able to come up with is storing the 
data in a database or making sure I store the fields when 
Activity#onSaveInstanceState.


All the options I listed above feel like more work than I would like to 
do for something that seems rather common. Does anyone have a simpler 
solution to this problem or is there a recommended best practice that I 
can follow?


Regards,

Pepijn

--

2. how to add omx decoders into stagefright of gingerbread

Hi Sparks,

I have read the source code of stagefright in gingerbread, and find
that stagefright has two methods to use codec:
   1. direct software codec called in OMXCodec class
   2. OMX plugins

I have heard that in froyo, stagefright shares opencore's omx  codec
plugins. however, gingerbread removed opencore totally.
So, my questions:
   1. if I want to add my own codec using the OMX way into
gingerbread's stagefright,  what should I do step by step?
   2. as to adding parser together with video and audio codec, what
should I do? for example, I want to add my own mkv parser with h264
and aac decoder(hardware or software decoder),
what should I do? can you explain it in details?



-- 

3. about the samsung android git address

4. How to transfer real-time data to mobile by USB and how to get the transfered data

5. How to write a android keyboard preference and show in Android Setting > Language & Keyboard.

6. Relief view on mapActivity?

7. Creating Activity from a View Class