I am making a simple media player application. It involes a textfield (et) where user just enters the exact name of the song to be played and presses the play button (ib1) to be played. Songs are saved inside sdcard. My code is:
ib1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String value = et.getText().toString();
String full_path = "/mnt/media_rw/sdcard/mymusic/" + value + ".mp3";
et.setText("");
mp = new MediaPlayer();
mp.setDataSource(full_path);
mp.prepare();
mp.start();
} });
But this produces Media Player error (-38.0). So, following Media Player called in state 0, error (-38,0) I tried to replace the mp lines with:
mp.setDataSource(full_path);
mp.setOnPreparedListener(null);
mp.prepareAsync();
mp.start();
But it won't work either, producing error (1, -2147483648). Can someone help me or make some suggestions for the code? Thanks a lot