title: android:play audio files using single mediaplayer object and also display images
body: <p>i need to display images and play corresponding audio files one after the other.</p>
  
  <p>i tried to create multiple media player objects but it shows <code>error(1, -17)</code></p>
  
  <p>so plz help guys i am running out of time.</p>
  
  <p>Right now i have a handler which plays audio file and then get the duration of that audio file while playing another audio file this is my approach but i am unable to play some 10 files</p>
  
  <p>below is my sample code</p>
  
  <pre><code>img.setBackgroundResource(R.drawable.d002_p001);
          d002_ae_p001 = MediaPlayer.create(this, R.raw.d002_ae_p001);
          handler.postDelayed(new Runnable() {
  
              @Override
              public void run() {
                  // TODO Auto-generated method stub
                  d002_ae_p001.start();
                  xml();
              }
          },1000);
  
          d002_ae_p002 = MediaPlayer.create(this,R.raw.d002_ae_p002);
          handler.postDelayed(new Runnable() {
  
              @Override
              public void run() {
                  // TODO Auto-generated method stub
                  i++;
                  img.setBackgroundResource(R.drawable.d002_p002);
                  d002_ae_p002.start();
                  xml();
              }
          },d002_ae_p001.getDuration()+2000);
  </code></pre>
  
  <p>EDITED THIS MY code</p>
  
  <pre><code>int image[] = {R.drawable.apple,R.drawable.boy,R.drawable.cat};
  
      String audio[]={"apple_v.mp3","boy_v.mp3","cat_v.mp3"};
  
      MediaPlayer mp = new MediaPlayer();
  
      AssetFileDescriptor descriptor;
              try {
                  descriptor = getAssets().openFd(audio[i]);
                  mp.setDataSource( descriptor.getFileDescriptor(), descriptor.getStartOffset(),descriptor.getLength());
                  descriptor.close();
                  mp.prepare();
                  mp.start();
              } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
              mp.setOnCompletionListener(new OnCompletionListener() {
  
                  @Override
                  public void onCompletion(MediaPlayer arg0) {
                      // TODO Auto-generated method stub
                      img.setImageResource(image[i]);
                      i++;
                      mp.start();
                  }
              });
  </code></pre>