I'm attempting to play files located in a Sounds directory located in
my assets directory.

The code below is what im using in my Listener method of my activity

 try {
    AssetManager mgr = getAssets();
//Lets me get file as i i'm using the Tag object of a radio button to
store the filename
    AssetFileDescriptor mgrFileDesc = mgr.openFd("Sounds/" +
grp.getChildAt(chkId).getTag().toString());

  FileDescriptor fd = mgrFileDesc.getFileDescriptor();
 MediaPlayer mPlay = new MediaPlayer();
 mPlay.setDataSource(fd);
Toast.makeText(getBaseContext(),fd.toString() ,
Toast.LENGTH_SHORT).show();
mPlay.prepare();
mPlay.start();
                        } catch (IOException e) {
                                        // TODO Auto-generated catch block
                                //      e.printStackTrace();
                                        
Toast.makeText(getBaseContext(),"ERROR:"+ e.getCause() ,
Toast.LENGTH_SHORT).show();
                                }

The first Toast message shows me that i have a FileDescriptor

The IOException error is telling me that the e.getCause() is null.
If i change the e.getMessage() it tells me    "prepare failed. status
0x1"

I'm lost..

What im attempting to achieve overall is to create a dynamic list of
radio buttons, that play a file.   So i used the assetManager to work
with the files in my assets folder, and was able to write the filename
to the radioButtons Tag object, and then reference that in my listener
method.

If someone can point me in the right direction, to either debug this,
or approach my task in a different manner.

Thanks in advance

-- 
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