Just wondering if this is a correct structure to use with try and exceptions:
MediaPlayer.OnCompletionListener videoViewCompletionListener = new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) throws IllegalStateException {
try {
mp.stop();
mp.release();
videoView.stopPlayback();
} finally {
toastDisplay.cancel();
toastDisplay = Toast.makeText(MainActivity.this, "Completed Video", Toast.LENGTH_LONG);
toastDisplay.show();
}
}
};
Will it crash my app or not when i do it this way, incase it throws the IllegalStateException
in this example?