public boolean parseKMZFile(File file){
  mLocalFile=file;
  Log.d(BonusPackHelper.LOG_TAG,"KmlProvider.parseKMZFile:" + mLocalFile.getAbsolutePath());
  try {
    ZipFile kmzFile=new ZipFile(mLocalFile);
    String rootFileName=null;
    Enumeration<? extends ZipEntry> list=kmzFile.entries();
    while (list.hasMoreElements() && rootFileName == null) {
      ZipEntry ze=list.nextElement();
      String name=ze.getName();
      if (name.endsWith(".kml") && !name.contains("/"))       rootFileName=name;
    }
    boolean result;
    if (rootFileName != null) {
      ZipEntry rootEntry=kmzFile.getEntry(rootFileName);
      InputStream stream=kmzFile.getInputStream(rootEntry);
      Log.d(BonusPackHelper.LOG_TAG,"KML root:" + rootFileName);
      result=parseKMLStream(stream,kmzFile);
    }
 else {
      Log.d(BonusPackHelper.LOG_TAG,"No .kml entry found.");
      result=false;
    }
    kmzFile.close();
    return result;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return false;
  }
}

public boolean parseKMZFile ( File file ) { mLocalFile = file ; Log . d ( BonusPackHelper . LOG_TAG , "KmlProvider.parseKMZFile:" + mLocalFile . getAbsolutePath ( ) ) ; try { ZipFile kmzFile = new ZipFile ( mLocalFile ) ; String rootFileName = null ; Enumeration < ? extends ZipEntry > list = kmzFile . entries ( ) ; while ( list . hasMoreElements ( ) && rootFileName == null ) { ZipEntry ze = list . nextElement ( ) ; String name = ze . getName ( ) ; if ( name . endsWith ( ".kml" ) && ! name . contains ( "/" ) ) rootFileName = name ; } boolean result ; if ( rootFileName != null ) { ZipEntry rootEntry = kmzFile . getEntry ( rootFileName ) ; InputStream stream = kmzFile . getInputStream ( rootEntry ) ; Log . d ( BonusPackHelper . LOG_TAG , "KML root:" + rootFileName ) ; result = parseKMLStream ( stream , kmzFile ) ; } else { Log . d ( BonusPackHelper . LOG_TAG , "No .kml entry found." ) ; result = false ; } kmzFile . close ( ) ; return result ; } catch ( Exception e ) { e . printStackTrace ( ) ; return false ; } }
parse a local kmz document .
