private void showToast ( @ Nullable final String text ) { if ( toast != null ) { toast . cancel ( ) ; } toast = Toast . makeText ( getActivity ( ) , text , Toast . LENGTH_SHORT ) ; toast . show ( ) ; }
Shows a specific toast and cancels a previous one if existing .