Code example for VideoView

Methods: setOnCompletionListenersetOnErrorListenersetOnPreparedListener

0
 
	} 
 
	private void addListener() 
	{ 
		mVideoView.setOnPreparedListener(new OnPreparedListener()
		{ 
			@Override 
			public void onPrepared(MediaPlayer mp)
			{ 
				// mVideoView.setBackgroundColor(Color.argb(0, 0, 255, 0)); 
				mVideoView.requestFocus();
				if (dialog.isShowing())
				{ 
					dialog.dismiss();
				} 
			} 
		}); 
		mVideoView.setOnErrorListener(new OnErrorListener()
		{ 
			@Override 
			public boolean onError(MediaPlayer arg0, int arg1, int arg2)
			{ 
				if (dialog.isShowing())
				{ 
					dialog.dismiss();
				} 
				return false; 
			} 
		}); 
		mVideoView.setOnCompletionListener(new OnCompletionListener()
		{ 
			@Override 
			public void onCompletion(MediaPlayer arg0)
			{ 
				finish();