title: Read content from APK expansion file (from obb file)
body: <p>I have implemented APK expansion file download service and all from <a href="http://developer.android.com/google/play/expansion-files.html" rel="nofollow noreferrer">http://developer.android.com/google/play/expansion-files.html</a></p>
  
  <p>I can download APK expansion file and I can see that file using below code</p>
  
  <pre><code>try {
          ZipResourceFile expansionFile = APKExpansionSupport
                  .getAPKExpansionZipFile(this, 3, 0);
  
          ZipEntryRO[] zip = expansionFile.getAllEntries();
          Log.e("", "" + zip[0].mFile.getAbsolutePath());
          Log.e("", "" + zip[0].mFileName);
          Log.e("", "" + zip[0].mZipFileName);
          Log.e("", "" + zip[0].mCompressedLength);
  
          AssetFileDescriptor fd = expansionFile
                  .getAssetFileDescriptor(zip[0].mFileName);
  
          if (fd != null &amp;&amp; fd.getFileDescriptor() != null) {
              MediaPlayer mp = new MediaPlayer();
              mp.setDataSource(fd.getFileDescriptor());
              mp.start();
          } else {
              Log.e("", "fd or fd.getFileDescriptor() is null");
          }
  
      } catch (IOException e) {
          e.printStackTrace();
      }
  </code></pre>
  
  <p>My obb is having file <code>test.mp4</code> and my code <code>Log.e("", "" + zip[0].mFileName);</code> prints <code>test.mp4.</code> </p>
  
  <p>My <code>fd</code> is <code>null</code>. Why is it <code>null</code>? I am trying to resolve but failed to resolve.</p>
  
  <p>I just can not read any file inside obb file.</p>
  
  <p>Unanswered <a href="https://stackoverflow.com/questions/12635069/accessing-to-files-inside-obb-expansion-file">Accessing to files inside obb expansion file</a> suggesting idea but it does not work for me.</p>
  
  <p><a href="https://stackoverflow.com/questions/11715855/steps-to-create-apk-expansion-file/11717019#11717019">Steps to create APK expansion file</a> tells unzip content from obb and then read it. Is it reliable and good?</p>
  
  <p>I need an opinion on best practice.</p>
  
  <h2>Edit</h2>
  
  <p>My log</p>
  
  <pre><code>03-01 10:36:40.848: E/(27836): zip[0].isUncompressed() : false
  03-01 10:36:40.848: E/(27836): mFile.getAbsolutePath() : /storage/sdcard0/Android/obb/smart.trigger/main.3.smart.trigger.obb
  03-01 10:36:40.848: E/(27836): mFileName : test.mp4
  03-01 10:36:40.848: E/(27836): mZipFileName : /storage/sdcard0/Android/obb/smart.trigger/main.3.smart.trigger.obb
  03-01 10:36:40.848: E/(27836): mCompressedLength : 21657598
  </code></pre>