调试时我无法创建MediaPlayer
当我点击声音按钮时,应用加载然后挂起.这是logcat错误我似乎无法找到出错的地方.
04-03 16:00:17.273: ERROR/gralloc(61): [unregister] handle 0x4456d0 still locked (state=40000001)
04-03 16:00:22.793: ERROR/PlayerDriver(31): Command PLAYER_PREPARE completed with an error or info PVMFErrResource
04-03 16:00:22.803: ERROR/MediaPlayer(279): error (1, -17)
04-03 16:00:17.273: ERROR/gralloc(61): [unregister] handle 0x4456d0 still locked (state=40000001)
Run Code Online (Sandbox Code Playgroud)
这是我的代码.
package com.yes.hotrod;
import android.app.Activity;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class main extends Activity {
MediaPlayer FilmSound=new MediaPlayer();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
Button button1 = (Button) findViewById(R.id.button1);
FilmSound = …Run Code Online (Sandbox Code Playgroud)