在android中,我编写一个简单的音频播放器,并在虚拟机上运行,但是却不能获得声音。使用AVD 能获得声音吗?
package com.example.helloplayer;
import android.app.Activity;
import android.media.MediaPlayer;
import android.os.Bundle;
public class HelloPlayer extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
MediaPlayer mp = new MediaPlayer();
mp.setDataSource("/home/usr/audio/file.mp3");
mp.prepare();
mp.start();
}
}