Back to project page City-Outdoors-Android.
The source code is released under:
Copyright (c) 2012, Edinburgh Council All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are ...
If you think the Android project City-Outdoors-Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package uk.co.jarofgreen.cityoutdoors.API; /* ww w.j a va 2 s.com*/ import java.io.File; import uk.co.jarofgreen.cityoutdoors.OurApplication; import uk.co.jarofgreen.cityoutdoors.R; import uk.co.jarofgreen.cityoutdoors.Storage; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; /** * This class is used because we shouldn't really pass Contexts to other processes. * When we start API calls from other threads, we sometimes may start other processes. * In this class, we extract all the information we may need from the context for the API classes to do their work, then discard the context. * */ public class InformationNeededFromContext { protected String serverURL; protected SharedPreferences settings; protected Storage storage; protected File cacheDir; public InformationNeededFromContext(Context context, OurApplication ourApplication) { serverURL = context.getString(R.string.server_url); settings=PreferenceManager.getDefaultSharedPreferences(context); storage = ourApplication.getStorage(); cacheDir = context.getCacheDir(); } public String getServerURL() { return serverURL; } public SharedPreferences getSettings() { return settings; } public Storage getStorage() { return storage; } public File getCacheDir() { return cacheDir; } }