title: setNextMediaPlayer with the same variable
body: <p>i'm new in android programming. what i want to do is to play sounds without overlapping the other sound. what i tried is the setNextMediaPlayer as suggested to me and it worked but what if i have set of random array like for example a4,a4,c4,b4,a4,b4 depending on the user input. </p>
  
  <p>for example the user input is: a4,a4,c4,b4,a4,b4</p>
  
  <pre><code> for (int i = 0; i &lt; tempq.size(); i++) {
              String u =tempq.get(i);
  
              //WHOLE
              if (u.equals("a4")){
                  mp = MediaPlayer.create(this, R.raw.a4);
                  mp.start();
  
  
              }else if (u.equals("b4")){
                  MediaPlayer mp1 = MediaPlayer.create(this, R.raw.b4);
                  mp.setNextMediaPlayer(mp1);
  
  
              }else if (u.equals("c4")){
                  MediaPlayer mp2= MediaPlayer.create(this, R.raw.c4);
                  mp.setNextMediaPlayer(mp2);
  
  
              }
          }
  </code></pre>
  
  <p>Please help. Thanks in advance! </p>
  
  <p>UPDATED CODE:</p>
  
  <p>code for adding list in refList:</p>
  
  <pre><code>   for (int i = 0; i &lt; tempq.size(); i++) {
              final String u =tempq.get(i);
  
              if (u.equals("a4")){
                  refList.add(R.raw.a4);
                  Log.d("References", refList.toString());
              }else if (u.equals("b4")){
                  refList.add(R.raw.b4);
                  Log.d("References", refList.toString());
              }
          }
  </code></pre>
  
  <p>code for playing sounds</p>
  
  <pre><code>   for (int i = 0; i &lt; refList.size(); i++) {
  
          if (i==0){
              mp = MediaPlayer.create(this, refList.get(i));
              mp.start();
  
          }else{
  
              MediaPlayer mp0 = MediaPlayer.create(this, refList.get(i));
              mp.setNextMediaPlayer(mp0);
  
          }
  
      }
  </code></pre>