src/main/java/de/blau/android/osm/StorageDelegator.java
/**
     * Read save data from file
     * 
     * @param context Android context
     * @param filename the file to read
     * @return true if the state was read successfully
     */
Read save data from file

@param context Android context
@param filename the file to read
@return true if the state was read successfully
Read save data from file @param context Android context @param filename the file to read @return true if the state was read successfully
public boolean readFromFile(Context context, String filename) {
        try {
            lock();
            StorageDelegator newDelegator = savingHelper.load(context, filename, true);
            if (newDelegator != null) {
                Log.d(DEBUG_TAG, "read saved state");
                currentStorage = newDelegator.currentStorage;
                if (currentStorage.getBoundingBoxes().isEmpty()) { 
                    try {
                        currentStorage.setBoundingBox(currentStorage.calcBoundingBoxFromData());
                    } catch (OsmException e) {
                        Log.e(DEBUG_TAG, "readFromFile got " + e.getMessage());
                    }
                }
                apiStorage = newDelegator.apiStorage;
                undo = newDelegator.undo;
                clipboard = newDelegator.clipboard;
                factory = newDelegator.factory;
                dirty = false; 
                return true;
            } else {
                Log.d(DEBUG_TAG, "saved state null");
                return false;
            }
        } finally {
            unlock();
        }
    }
public boolean readFromFile ( Context context , String filename ) { try { lock ( ) ; StorageDelegator newDelegator = savingHelper . load ( context , filename , true ) ; if ( newDelegator != null ) { Log . d ( DEBUG_TAG , "read saved state" ) ; currentStorage = newDelegator . currentStorage ; if ( currentStorage . getBoundingBoxes ( ) . isEmpty ( ) ) { try { currentStorage . setBoundingBox ( currentStorage . calcBoundingBoxFromData ( ) ) ; } catch ( OsmException e ) { Log . e ( DEBUG_TAG , "readFromFile got " + e . getMessage ( ) ) ; } } apiStorage = newDelegator . apiStorage ; undo = newDelegator . undo ; clipboard = newDelegator . clipboard ; factory = newDelegator . factory ; dirty = false ; return true ; } else { Log . d ( DEBUG_TAG , "saved state null" ) ; return false ; } } finally { unlock ( ) ; } }
Read save data from file
Read save data from file
// can happen if data was added before load // data was just read, i.e. memory and file are in sync