title: How to know onSurfaceTextureAvailable is called for which TextureView
body: <p>I am writing an application where I need to display two <code>TextureView</code>(s) on my activity. I am attaching videos to each of the <code>TextureView</code> instance using <code>MediaPlayer</code> objects using the following code inside <code>onSurfaceTextureAvailable()</code>:</p>
  
  <pre><code>@Override
  public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i1) {
  
      Surface surface = new Surface(surfaceTexture);
  
      mMediaPlayer1 = new MediaPlayer();
  
      try {
          mMediaPlayer1.setDataSource(&lt;filePath&gt;);
      } catch (IOException e) {
          Log.e(TAG, "Unable to load the file from the file system", e);
          return;
      }
  
      mMediaPlayer1.setSurface(surface);
      mMediaPlayer1.setLooping(true);
      mMediaPlayer1.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
          @Override
          public void onPrepared(MediaPlayer mediaPlayer) {
              isPlaybackReady = true;
          }
      });
  
      mMediaPlayer1.prepareAsync();
  }
  </code></pre>
  
  <p>Now, if I have two instances of <code>TextureView</code>, how would I know the callback into <code>onSurfaceTextureAvailable(...)</code> is for which <code>TextureView</code>.  </p>
  
  <p>The other way is to setup the <code>MediaPlayer</code> objects outside the <code>onSurfaceTextureAvailable(...)</code>, by getting a hold over the associated <code>SurfaceTexture</code> by calling <code>TextureView.getSurfaceTexture()</code>. I tried that as well but it always returns <code>null</code>. Is there something else that I need to do for this?</p>