我正在构建一个需要播放录制声音的录音机.我在播放音频时遇到了很多麻烦.我知道该文件存在是因为我将其隔离到SD卡上的文件夹中,但由于某种原因它无法播放.
这是我的代码:
public class RecorderEditActivity extends SherlockActivity implements
DatabaseHelper.MetadataListener {
private long position;
private Button playButton = null;
private TextView date = null;
private EditText title = null;
private EditText notes = null;
private Button saveButton = null;
private MediaPlayer mediaPlayer = null;
private boolean isPlaying = false;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.edit_item);
position = getIntent().getExtras().getLong(DatabaseHelper.KEY_ROWID);
playButton = (Button) findViewById(R.id.play);
date = (TextView) findViewById(R.id.recording_date);
title = (EditText) findViewById(R.id.edit_title);
notes = (EditText) findViewById(R.id.edit_notes);
saveButton = (Button) findViewById(R.id.save_edit_button);
mediaPlayer …Run Code Online (Sandbox Code Playgroud)