public boolean loadVariables(){
  String file=readFile();
  if (file == null) {
    return false;
  }
  JSONObject jo;
  try {
    boolean loadMap=false;
    jo=new JSONObject(file);
    setTravelMode(jo.getString("travelMode"));
    setWeighting(jo.getString("weighting"));
    setRoutingAlgorithms(jo.getString("routingAlgorithms"));
    setDirectionsON(jo.getBoolean("directionsON"));
    setAdvancedSetting(jo.getBoolean("advancedSetting"));
    setZoomLevelMax(jo.getInt("zoomLevelMax"));
    setZoomLevelMin(jo.getInt("zoomLevelMin"));
    setLastZoomLevel(jo.getInt("lastZoomLevel"));
    double la=jo.getDouble("latitude");
    double lo=jo.getDouble("longitude");
    if (la != 0 && lo != 0) {
      setLastLocation(new LatLong(la,lo));
    }
    String coun=jo.getString("country");
    if (coun != "") {
      setCountry(jo.getString("country"));
      loadMap=true;
    }
    setMapDirectory(jo.getString("mapDirectory"));
    setMapsFolder(new File(jo.getString("mapsFolderAbsPath")));
    setSportCategoryIndex(jo.getInt("sportCategoryIndex"));
    setDownloadStatus(jo.getInt("mapDownloadStatus"));
    setMapLastModified(jo.getString("mapLastModified"));
    setMapFinishedPercentage(jo.getInt("mapFinishedPercentage"));
    setPausedMapName(jo.getString("pausedMapName"));
    if (getPausedMapName() != "") {
      loadMap=false;
    }
    if (!hasUnfinishedDownload()) {
      resetDownloadMapVariables();
    }
    return loadMap;
  }
 catch (  JSONException e) {
    e.printStackTrace();
    return false;
  }
}

public boolean loadVariables ( ) { String file = readFile ( ) ; if ( file == null ) { return false ; } JSONObject jo ; try { boolean loadMap = false ; jo = new JSONObject ( file ) ; setTravelMode ( jo . getString ( "travelMode" ) ) ; setWeighting ( jo . getString ( "weighting" ) ) ; setRoutingAlgorithms ( jo . getString ( "routingAlgorithms" ) ) ; setDirectionsON ( jo . getBoolean ( "directionsON" ) ) ; setAdvancedSetting ( jo . getBoolean ( "advancedSetting" ) ) ; setZoomLevelMax ( jo . getInt ( "zoomLevelMax" ) ) ; setZoomLevelMin ( jo . getInt ( "zoomLevelMin" ) ) ; setLastZoomLevel ( jo . getInt ( "lastZoomLevel" ) ) ; double la = jo . getDouble ( "latitude" ) ; double lo = jo . getDouble ( "longitude" ) ; if ( la != 0 && lo != 0 ) { setLastLocation ( new LatLong ( la , lo ) ) ; } String coun = jo . getString ( "country" ) ; if ( coun != "" ) { setCountry ( jo . getString ( "country" ) ) ; loadMap = true ; } setMapDirectory ( jo . getString ( "mapDirectory" ) ) ; setMapsFolder ( new File ( jo . getString ( "mapsFolderAbsPath" ) ) ) ; setSportCategoryIndex ( jo . getInt ( "sportCategoryIndex" ) ) ; setDownloadStatus ( jo . getInt ( "mapDownloadStatus" ) ) ; setMapLastModified ( jo . getString ( "mapLastModified" ) ) ; setMapFinishedPercentage ( jo . getInt ( "mapFinishedPercentage" ) ) ; setPausedMapName ( jo . getString ( "pausedMapName" ) ) ; if ( getPausedMapName ( ) != "" ) { loadMap = false ; } if ( ! hasUnfinishedDownload ( ) ) { resetDownloadMapVariables ( ) ; } return loadMap ; } catch ( JSONException e ) { e . printStackTrace ( ) ; return false ; } }
run when app open at run time < p / > load variables from saved file
