title: Reading mp3 from expansion file
body: <p>Reading mp3 file from expansion file</p>
  
  <p>I have create and expansion file with name </p>
  
  <p>"main.1.com.example.app.obb"</p>
  
  <p>which contains and audio file name "about_eng.mp3"</p>
  
  <p>Now the issue i have written the following code to read and play the mp3 file</p>
  
  <pre><code>    private final static String EXP_PATH = "/Android/obb/";
  
  static String[] getAPKExpansionFiles(Context ctx, int mainVersion, int patchVersion) {
      String packageName = ctx.getPackageName();
      Vector&lt;String&gt; ret = new Vector&lt;String&gt;();
      if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
          // Build the full path to the app's expansion files
          File root = Environment.getExternalStorageDirectory();
          File expPath = new File(root.toString() + EXP_PATH + packageName);
  
          // Check that expansion file path exists
          if (expPath.exists()) {
              if ( mainVersion &gt; 0 ) {
                  String strMainPath = expPath + File.separator + "main." +
                          mainVersion + "." + packageName + ".obb";
                  File main = new File(strMainPath);
                  if ( main.isFile() ) {
                          ret.add(strMainPath);
                  }
              }
              if ( patchVersion &gt; 0 ) {
                  String strPatchPath = expPath + File.separator + "patch." +
                          mainVersion + "." + packageName + ".obb";
                  File main = new File(strPatchPath);
                  if ( main.isFile() ) {
                          ret.add(strPatchPath);
                  }
              }
          }
      }
      String[] retArray = new String[ret.size()];
      ret.toArray(retArray);
      return retArray;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
      // Get a ZipResourceFile representing a merger of both the main and patch files
  
      try {
          ZipResourceFile expansionFile = APKExpansionSupport.getAPKExpansionZipFile(this,1,1);
          if(expansionFile!=null){
  
              AssetFileDescriptor fd = expansionFile.getAssetFileDescriptor("about_eng.mp3");
                  //or
              MediaPlayer mediaPlayer = new MediaPlayer();
              mediaPlayer.setDataSource( fd.getFileDescriptor(), 
                      fd.getStartOffset(),fd.getLength());
              mediaPlayer.prepare();
              mediaPlayer.start();
  
              }
  
  
  
  
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  
      // Get an input stream for a known file inside the expansion file ZIPs
  
  
  }
  </code></pre>
  
  <p>But it is always throwing exception at this line</p>
  
  <pre><code> mediaPlayer.setDataSource( fd.getFileDescriptor(), 
                      fd.getStartOffset(),fd.getLength());
              mediaPlayer.prepare();
  </code></pre>
  
  <p>because the variable fd is null.</p>
  
  <p>Can any body help me to solve this</p>