我正在使用PhoneStateListner来获取来电号码我成功获得号码。但我想在来电期间播放视频,在我用来播放视频的代码下面,
我收到错误
01-23 17:44:41.199: E/MediaPlayer-JNI(25145): Not Using QCMediaPlayer,setting qc_post_event to NULL...
01-23 17:44:41.199: E/MediaPlayer(25145): Uri is <URL suppressed>
01-23 17:44:41.219: E/MediaPlayer(25145): error (1, -2147483648)
01-23 17:44:41.309: E/MediaPlayer(25145): Error (1,-2147483648)
01-23 17:44:41.319: D/VideoView(25145): Error: 1,-2147483648
01-23 17:44:49.228: E/MediaPlayer(25145): Uri is <URL suppressed>
01-23 17:44:49.228: E/MediaPlayer(25145): error (1, -2147483648)
01-23 17:44:49.278: E/MediaPlayer(25145): Error (1,-2147483648)
01-23 17:44:49.278: D/VideoView(25145): Error: 1,-2147483648
01-23 17:46:13.127: E/MediaPlayer(25145): Uri is <URL suppressed>
01-23 17:46:13.127: E/MediaPlayer(25145): error (1, -2147483648)
01-23 17:46:16.881: E/MediaPlayer(25145): Uri is <URL suppressed>
01-23 17:46:16.891: E/MediaPlayer(25145): error (1, -2147483648)
01-23 17:46:16.932: E/MediaPlayer(25145): Error (1,-2147483648)
01-23 17:46:16.932: D/VideoView(25145): Error: 1,-2147483648
我的代码是
videoView =(VideoView)findViewById(R.id.videoView1); mediaController = new MediaController(this);
telephonyManager =(TelephonyManager)MainActivity.this.getSystemService(Context.TELEPHONY_SERVICE);
PhoneStateListener phoneStateListener = new PhoneStateListener()
{
@Override
public void onCallStateChanged(int state, String incomingNumber) {
// TODO Auto-generated method stub
if(state ==TelephonyManager.CALL_STATE_RINGING )
{
Intent i = new Intent(MainActivity.this,MainActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT
|Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
|Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
mediaController.setMediaPlayer(videoView);
videopath = Environment.getExternalStorageDirectory()+"/bluetooth/charlie.mp4";
videoView.setVideoPath(videopath);
videoView.start();
videoView.bringToFront();
Toast.makeText(getApplicationContext(), "Incoming call"+incomingNumber, Toast.LENGTH_LONG).show();
}
super.onCallStateChanged(state, incomingNumber);
}
};
telephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
它正在播放视频,但在后面,但我需要在前面播放视频。