我有一个错误:
public class VisualizerCapture extends Activity implements Visualizer.OnDataCaptureListener {
private Visualizer mVisualizer = new Visualizer(0); // error is here!!!
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setupVisualizer();
}
这是抛出的错误:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{bla bla}: java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -4
我的清单:
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.INTERNET"/>
设置方法:
private void setupVisualizer() {
Visualizer.setEnabled(false);
Visualizer.setCaptureSize(1); //test
Visualizer.setDataCaptureListener(this,250,false,true);
//Visualizer.setScalingMode(visualizer.SCALING_MODE_AS_PLAYED);
Visualizer.setEnabled(true);
Log.v("ABS","setupVisualizer" + Visualizer.getEnabled()); //log
}
为什么我得到这个错误?好像我已经满足了所有权限?
请耐心等待,我是开发新手。我怎样才能解决这个问题?