title: Playing a sound file through a menu item
body: <p>I am trying to play a sound file through a menu item which exists in a fragment. </p>
  
  <p>Here is the full code of my fragment,</p>
  
  <pre><code>public class OneFragment extends Fragment {
  
  public OneFragment() {
      // Required empty public constructor
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
  
      super.onCreate(savedInstanceState);
  
  }
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      View rootview = inflater.inflate(R.layout.fragment_one, container,false);
  
      ImageButton popupCTelevision = (ImageButton)rootview.findViewById(R.id.chineseTelevision);
      ImageButton popupCBathe = (ImageButton)rootview.findViewById(R.id.chineseBathe);
      ImageButton popupCSick = (ImageButton)rootview.findViewById(R.id.chineseSick);
  
      popupCTelevision.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {
  
              PopupMenu popupMenu = new PopupMenu(getActivity().getApplicationContext(), v);
              popupMenu.inflate(R.menu.menu_chinese_television);
              popupMenu.show();
  
          }
      });
  
      popupCBathe.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {
  
              PopupMenu popupMenu = new PopupMenu(getActivity().getApplicationContext(), v);
              popupMenu.inflate(R.menu.menu_chinese_bathe);
              popupMenu.show();
  
          }
      });
  
      popupCSick.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {
  
              PopupMenu popupMenu = new PopupMenu(getActivity().getApplicationContext(), v);
              popupMenu.inflate(R.menu.menu_chinese_sick);
              popupMenu.show();
  
          }
      });
  
  
      return rootview;
  }
  
  
  public boolean onMenuItemClick(MenuItem item){
      switch(item.getItemId()) {
          case R.id.c_bathe:
              final MediaPlayer CSick = MediaPlayer.create(getActivity(), R.raw.c_bathe);
              MenuItem playCSick = (MenuItem) getView().findViewById(R.id.c_sick);
              CSick.start();
  
              playCSick.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                  @Override
                  public boolean onMenuItemClick(MenuItem item) {
  
                      CSick.start();
                      return true;
                  }
              });
          default:
              return false;
  
  
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I think the issue is that the method <code>onMenuItemClick</code> is not used at all. How do I implement this method for the code?</p>
  
  <p>How do I do it similarly to pressing a button to play the sound file?</p>
  
  <pre><code>final MediaPlayer englishSoundMP = MediaPlayer.create(this, R.raw.english_bath);
      Button playEnglishBath = (Button) this.findViewById(R.id.play_english);
      playEnglishBath.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              englishSoundMP.start();
          }
      });
  </code></pre>