public boolean saveAsKML(File file){
  try {
    Log.d(BonusPackHelper.LOG_TAG,"Saving " + file.getAbsolutePath());
    OutputStreamWriter out=new OutputStreamWriter(new FileOutputStream(file),"UTF-8");
    BufferedWriter writer=new BufferedWriter(out,8192);
    boolean result=saveAsKML(writer);
    writer.close();
    Log.d(BonusPackHelper.LOG_TAG,"Saved.");
    return result;
  }
 catch (  IOException e) {
    e.printStackTrace();
    return false;
  }
}

public boolean saveAsKML ( File file ) { try { Log . d ( BonusPackHelper . LOG_TAG , "Saving " + file . getAbsolutePath ( ) ) ; OutputStreamWriter out = new OutputStreamWriter ( new FileOutputStream ( file ) , "UTF-8" ) ; BufferedWriter writer = new BufferedWriter ( out , 8192 ) ; boolean result = saveAsKML ( writer ) ; writer . close ( ) ; Log . d ( BonusPackHelper . LOG_TAG , "Saved." ) ; return result ; } catch ( IOException e ) { e . printStackTrace ( ) ; return false ; } }
save the document as a kml file
