mercredi 22 avril 2015

Play a sound file on mediaplayer with button within ListView item in Android with filepath loaded from SQLite

I record some sounds and I save them in /storage/emulated/0/AudioRecorder folder. Then I save the filepath in SQLite database. So when I populate my listview based on a baseadapter in which my getview has the button clicklistener. So far everything seems good. But when I click on button nothing happens. The debugging shows that button finds the position of the proper list item, method which plays the sound finds the filepath but nothing is playing.

 public void playSoundItem(int id)

    final String SoundFile = MyItems.get(id).getItemFilepath();
    mMediaPlayer = new MediaPlayer();
    try {
        //Uri mp4 = Uri.parse(file + "/" + myList.get(soundPosition));
        //Uri mp4 = Uri.parse(SoundFile);

        mMediaPlayer = new MediaPlayer();
    } catch (Exception e) {

I have tested it with uri parsing and again the same thing. The value of SoundFile is: /storage/emulated/0/AudioRecorder/MySound21-04-2015 20:38.mp4 Do I have to parse it to something else

Aucun commentaire:

Enregistrer un commentaire