title: Toast displayed twice
body: <p>I have two spinners in a fragment, one of the spinner will display toast message when an item is selected. The problem is the toast in the first if-else statement displayed twice. Once when open the fragment and the second time when the item selected. </p>
  
  <pre><code>@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
      mRootView = inflater.inflate(R.layout.add, container, false);
  
  
  
      //------------------------------unit Spinner adapter---------------------------------------//
      Spinner spinner = (Spinner) mRootView.findViewById(R.id.units);
  
      //Create ArrayAdapter using string array and default spinner
      ArrayAdapter&lt;CharSequence&gt; sAdapter = ArrayAdapter.createFromResource(getActivity(), R.array.units, android.R.layout.simple_spinner_dropdown_item);
  
      //Specify layout to use when list of choices appears
      sAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  
      //Apply adapter to the spinner
      spinner.setAdapter(sAdapter);
  
  
      //----------------------------reminder Spinner adapter-------------------------------------//
      Spinner reminderSpinner = (Spinner) mRootView.findViewById(R.id.list_reminder);
      ArrayAdapter&lt;CharSequence&gt; reminderAdapter = ArrayAdapter.createFromResource(getActivity(), R.array.countdown_reminder, android.R.layout.simple_spinner_dropdown_item);
      reminderAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      reminderSpinner.setAdapter(reminderAdapter);
  
  
  
      spinner.setOnItemSelectedListener(spinnerListener);
      reminderSpinner.setOnItemSelectedListener(spinnerListener);
  
  return mRootView;
  }
  
  
      //---------------------------------Spinner Listener----------------------------------------//
      AdapterView.OnItemSelectedListener spinnerListener = new AdapterView.OnItemSelectedListener() {
  
          public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) {
  
              switch (parent.getId()) {
  
                  case R.id.units:
                      String selectedUnit = parent.getItemAtPosition(position).toString();
                      break;
                  case R.id.list_reminder:
                      String reminder = parent.getItemAtPosition(position).toString();
  
  
                      if (reminder.equals("24 hours")) {
                          Toast.makeText(getActivity(), "Reminder has been set 24 hours from the selected date", Toast.LENGTH_LONG).show();
  
                      } else if (reminder.equals("2 days")) {
                          Toast.makeText(getActivity(), "Reminder has been set 2 days from the selected date", Toast.LENGTH_LONG).show();
  
                      } else if (reminder.equals("3 days")) {
                          Toast.makeText(getActivity(), "Reminder has been set 3 days from the selected date", Toast.LENGTH_LONG).show();
  
                      } else if (reminder.equals("1 week")) {
                          Toast.makeText(getActivity(), "Reminder has been set 1 week from the selected date", Toast.LENGTH_LONG).show();
  
                      } else if (reminder.equals("2 weeks")) {
                          Toast.makeText(getActivity(), "Reminder has been set 2 weeks from the selected date", Toast.LENGTH_LONG).show();
  
                      } else if (reminder.equals("1 month")) {
                          Toast.makeText(getActivity(), "Reminder has been set 1 month from the selected date", Toast.LENGTH_LONG).show();
                      }
                      break;
              }
          }
  
  
          public void onNothingSelected(AdapterView&lt;?&gt; parent) {
          }
      };
      //------------------------------------end spinner code-------------------------------------//
  </code></pre>
  
  <p>The '24 hours' toast displayed when user open the fragment and when the '24 hours' selected. I can't figure out what's wrong with the code. Help please?!</p>