I have the following code:
private Toast movieRecordToast;
private void displayNextMovie() {
if (movieRecordToast != null) movieRecordToast.canc
I think there are many ways you can achieve displaying the next/prev info to the user. I would ditch the toasts altogether and update the text of a TextView with the name of next/prev movie. That would eliminate your problem and also IMHO makes for better UI.
However, if your design requirements do ask for toast notifications, try:
private Toast nextMovieRecordToast;
private Toast prevMovieRecordToast;
private void displayNextMovie() {
if (prevMovieRecordToast != null) prevMovieRecordToast.cancel(); // cancel previous Toast (if user changes movies too often)
nextMovieRecordToast = Toast.makeText(getApplicationContext(), "Next", Toast.LENGTH_SHORT);
nextMovieRecordToast.show();}
private void displayPrevMovie() {
if (nextMovieRecordToast != null) nextMovieRecordToast.cancel();
prevMovieRecordToast = Toast.makeText(getApplicationContext(), "Prev", Toast.LENGTH_SHORT);
prevMovieRecordToast.show(); }