public boolean onSaveSnapshot(Bundle mSavedInstanceState){
  Bundle blocklyState=new Bundle();
  ByteArrayOutputStream out=new ByteArrayOutputStream();
  try {
    mWorkspace.serializeToXml(out);
    blocklyState.putByteArray(SERIALIZED_WORKSPACE_KEY,out.toByteArray());
  }
 catch (  BlocklySerializerException e) {
    Log.w(TAG,"Error serializing workspace.",e);
    return false;
  }
 finally {
    try {
      out.close();
    }
 catch (    IOException e) {
    }
  }
  mSavedInstanceState.putBundle(SNAPSHOT_BUNDLE_KEY,blocklyState);
  return true;
}

public boolean onSaveSnapshot ( Bundle mSavedInstanceState ) { Bundle blocklyState = new Bundle ( ) ; ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; try { mWorkspace . serializeToXml ( out ) ; blocklyState . putByteArray ( SERIALIZED_WORKSPACE_KEY , out . toByteArray ( ) ) ; } catch ( BlocklySerializerException e ) { Log . w ( TAG , "Error serializing workspace." , e ) ; return false ; } finally { try { out . close ( ) ; } catch ( IOException e ) { } } mSavedInstanceState . putBundle ( SNAPSHOT_BUNDLE_KEY , blocklyState ) ; return true ; }
saves a snapshot of current workspace contents to a temporary cache file , and saves the filename to the instance state bundle .
