我开发了直播应用程序,但有时直播不可用 我想在不可用时显示错误或警报消息 我该怎么做?
这是我的创建功能:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE){
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
setContentView(R.layout.activity_shada);
videoView = (VideoView) findViewById(R.id.myVideoView);
videoView.setVideoURI(Uri.parse(httpLiveUrl));
videoView.requestFocus();
videoView.start();
pro = ProgressDialog.show(this, "", "Loading....");
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
// TODO Auto-generated method stub
pro.dismiss();
}
});
}