title: Image and sound in Array change by clicking on next button in Android
body: <p>EDIT- I found the solution for the issue 
  I put mysound++;  View.OnClickListener aButtonChangeImageListener = new View.OnClickListener(      </p>
  
  <p>I have app with array of pictures and sounds. When user click next button the pictures change to next one. The problem I have is that I can't change the sound to the next one as well. The app is playing the first sound all the time or it plays all sounds from array.
  I need to have the sound changes to next one after next button is clicked to reflect picture change. Example: picture a1 = sound1, picture a2 = sound2.</p>
  
  <p>private ImageButton MainImage, ImageLeft, ImageRight;
      private ImageButton nextButton;</p>
  
  <pre><code>private int currentImage = 0;
  int[] images = { R.drawable.a1, R.drawable.b1, R.drawable.c1, R.drawable.d1, R.drawable.e1, R.drawable.f1 };
  private int currentImage2 = 0;
  int[] images2 = { R.drawable.a2, R.drawable.b2, R.drawable.c2, R.drawable.d2, R.drawable.e2, R.drawable.f2 };
  private int currentImage3 = 0;
  int[] images3 = { R.drawable.a3, R.drawable.b3, R.drawable.c3, R.drawable.d3, R.drawable.e3, R.drawable.f3 };
  private int[] sounds = { R.raw.sound1, R.raw.sound2, R.raw.sound3, R.raw.sound4, R.raw.sound5, R.raw.sound6,  };
  private int mysound = 0;
  private int[] sounds2 = { R.raw.sound1a, R.raw.sound2a, R.raw.sound3a,R.raw.sound4a, R.raw.sound5a, R.raw.sound6a,  };
  private int mysound2 = 0;
  MediaPlayer mp;
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_aplhascreen);
  
      MainImage = (ImageButton) findViewById(R.id.imageButton1);
      ImageLeft = (ImageButton) findViewById(R.id.imageButton2);
      ImageRight = (ImageButton) findViewById(R.id.imageButton3);
      nextButton = (ImageButton) findViewById(R.id.imageButton5);
  
      ImageLeft.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
  
              mp = MediaPlayer.create(Alphascreen.this, sounds[0]);
              mp.start();
              mysound++;
  
              ImageRight.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                  mp = MediaPlayer.create(Alphascreen.this, sounds2[0]);
                      mp.start();
                      mysound2++;
  
                  }
  
              });
  
              nextButton.setOnClickListener(aButtonChangeImageListener);
  
          }
  
          View.OnClickListener aButtonChangeImageListener = new View.OnClickListener() {
  
              public void onClick(View v) {
                  currentImage++;
                  currentImage = currentImage % images.length;
                  currentImage2++;
                  currentImage2 = currentImage2 % images.length;
                  currentImage3++;
                  currentImage3 = currentImage3 % images.length;
                 mysound++;
                  mysound = mysound % sounds.length;
                 mysound2++;
                 mysound2 = mysound2 % sounds2.length;
  
                  MainImage.setImageResource(images[currentImage]);
                  ImageLeft.setImageResource(images2[currentImage2]);
                  ImageRight.setImageResource(images3[currentImage3]);
  
              }
          };
      });
  }}
  </code></pre>