/** * Uses the URI scheme for showing a location found on a map in conjunction with * an implicit Intent. This super-handy Intent is detailed in the "Common Intents" page of * Android's developer site: * * @see "http://developer.android.com/guide/components/intents-common.html#Maps" * <p> * Protip: Hold Command on Mac or Control on Windows and click that link to automagically * open the Common Intents page */ private void openPreferredLocationInMap() { double[] coords = SunshinePreferences.getLocationCoordinates(this); String posLat = Double.toString(coords[0]); String posLong = Double.toString(coords[1]); Uri geoLocation = Uri.parse("geo:" + posLat + "," + posLong); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(geoLocation); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Log.d(TAG, "Couldn't call " + geoLocation.toString() + ", no receiving apps installed!"); } }
/** * Uses the URI scheme for showing a location found on a map in conjunction with * an implicit Intent. This super-handy Intent is detailed in the "Common Intents" page of * Android's developer site: * * @see "http://developer.android.com/guide/components/intents-common.html#Maps" * <p> * Protip: Hold Command on Mac or Control on Windows and click that link to automagically * open the Common Intents page */ private void openPreferredLocationInMap() { double[] coords = SunshinePreferences.getLocationCoordinates(this); String posLat = Double.toString(coords[0]); String posLong = Double.toString(coords[1]); Uri geoLocation = Uri.parse("geo:" + posLat + "," + posLong); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(geoLocation); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Log.d(TAG, "Couldn't call " + geoLocation.toString() + ", no receiving apps installed!"); } }
/** * Uses the URI scheme for showing a location found on a map in conjunction with * an implicit Intent. This super-handy Intent is detailed in the "Common Intents" page of * Android's developer site: * * @see "http://developer.android.com/guide/components/intents-common.html#Maps" * <p> * Protip: Hold Command on Mac or Control on Windows and click that link to automagically * open the Common Intents page */ private void openPreferredLocationInMap() { double[] coords = SunshinePreferences.getLocationCoordinates(this); String posLat = Double.toString(coords[0]); String posLong = Double.toString(coords[1]); Uri geoLocation = Uri.parse("geo:" + posLat + "," + posLong); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(geoLocation); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Log.d(TAG, "Couldn't call " + geoLocation.toString() + ", no receiving apps installed!"); } }
/** * Uses the URI scheme for showing a location found on a map in conjunction with * an implicit Intent. This super-handy Intent is detailed in the "Common Intents" page of * Android's developer site: * * @see "http://developer.android.com/guide/components/intents-common.html#Maps" * <p> * Protip: Hold Command on Mac or Control on Windows and click that link to automagically * open the Common Intents page */ private void openPreferredLocationInMap() { double[] coords = SunshinePreferences.getLocationCoordinates(this); String posLat = Double.toString(coords[0]); String posLong = Double.toString(coords[1]); Uri geoLocation = Uri.parse("geo:" + posLat + "," + posLong); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(geoLocation); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Log.d(TAG, "Couldn't call " + geoLocation.toString() + ", no receiving apps installed!"); } }
/** * Uses the URI scheme for showing a location found on a map in conjunction with * an implicit Intent. This super-handy Intent is detailed in the "Common Intents" page of * Android's developer site: * * @see "http://developer.android.com/guide/components/intents-common.html#Maps" * <p> * Protip: Hold Command on Mac or Control on Windows and click that link to automagically * open the Common Intents page */ private void openPreferredLocationInMap() { double[] coords = SunshinePreferences.getLocationCoordinates(this); String posLat = Double.toString(coords[0]); String posLong = Double.toString(coords[1]); Uri geoLocation = Uri.parse("geo:" + posLat + "," + posLong); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(geoLocation); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Log.d(TAG, "Couldn't call " + geoLocation.toString() + ", no receiving apps installed!"); } }
/** * Uses the URI scheme for showing a location found on a map in conjunction with * an implicit Intent. This super-handy Intent is detailed in the "Common Intents" page of * Android's developer site: * * @see "http://developer.android.com/guide/components/intents-common.html#Maps" * <p> * Protip: Hold Command on Mac or Control on Windows and click that link to automagically * open the Common Intents page */ private void openPreferredLocationInMap() { double[] coords = SunshinePreferences.getLocationCoordinates(this); String posLat = Double.toString(coords[0]); String posLong = Double.toString(coords[1]); Uri geoLocation = Uri.parse("geo:" + posLat + "," + posLong); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(geoLocation); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Log.d(TAG, "Couldn't call " + geoLocation.toString() + ", no receiving apps installed!"); } }
/** * Uses the URI scheme for showing a location found on a map in conjunction with * an implicit Intent. This super-handy Intent is detailed in the "Common Intents" page of * Android's developer site: * * @see "http://developer.android.com/guide/components/intents-common.html#Maps" * <p> * Protip: Hold Command on Mac or Control on Windows and click that link to automagically * open the Common Intents page */ private void openPreferredLocationInMap() { double[] coords = SunshinePreferences.getLocationCoordinates(this); String posLat = Double.toString(coords[0]); String posLong = Double.toString(coords[1]); Uri geoLocation = Uri.parse("geo:" + posLat + "," + posLong); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(geoLocation); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Log.d(TAG, "Couldn't call " + geoLocation.toString() + ", no receiving apps installed!"); } }
/** * Uses the URI scheme for showing a location found on a map in conjunction with * an implicit Intent. This super-handy Intent is detailed in the "Common Intents" page of * Android's developer site: * * @see "http://developer.android.com/guide/components/intents-common.html#Maps" * <p> * Protip: Hold Command on Mac or Control on Windows and click that link to automagically * open the Common Intents page */ private void openPreferredLocationInMap() { double[] coords = SunshinePreferences.getLocationCoordinates(this); String posLat = Double.toString(coords[0]); String posLong = Double.toString(coords[1]); Uri geoLocation = Uri.parse("geo:" + posLat + "," + posLong); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(geoLocation); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Log.d(TAG, "Couldn't call " + geoLocation.toString() + ", no receiving apps installed!"); } }
/** * Uses the URI scheme for showing a location found on a map in conjunction with * an implicit Intent. This super-handy Intent is detailed in the "Common Intents" page of * Android's developer site: * * @see "http://developer.android.com/guide/components/intents-common.html#Maps" * <p> * Protip: Hold Command on Mac or Control on Windows and click that link to automagically * open the Common Intents page */ private void openPreferredLocationInMap() { double[] coords = SunshinePreferences.getLocationCoordinates(this); String posLat = Double.toString(coords[0]); String posLong = Double.toString(coords[1]); Uri geoLocation = Uri.parse("geo:" + posLat + "," + posLong); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(geoLocation); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Log.d(TAG, "Couldn't call " + geoLocation.toString() + ", no receiving apps installed!"); } }
/** * Uses the URI scheme for showing a location found on a map in conjunction with * an implicit Intent. This super-handy Intent is detailed in the "Common Intents" page of * Android's developer site: * * @see "http://developer.android.com/guide/components/intents-common.html#Maps" * <p> * Protip: Hold Command on Mac or Control on Windows and click that link to automagically * open the Common Intents page */ private void openPreferredLocationInMap() { double[] coords = SunshinePreferences.getLocationCoordinates(this); String posLat = Double.toString(coords[0]); String posLong = Double.toString(coords[1]); Uri geoLocation = Uri.parse("geo:" + posLat + "," + posLong); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(geoLocation); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Log.d(TAG, "Couldn't call " + geoLocation.toString() + ", no receiving apps installed!"); } }
/** * Retrieves the proper URL to query for the weather data. The reason for both this method as * well as {@link #buildUrlWithLocationQuery(String)} is two fold. * <p> * 1) You should be able to just use one method when you need to create the URL within the * app instead of calling both methods. * 2) Later in Sunshine, you are going to add an alternate method of allowing the user * to select their preferred location. Once you do so, there will be another way to form * the URL using a latitude and longitude rather than just a location String. This method * will "decide" which URL to build and return it. * * @param context used to access other Utility methods * @return URL to query weather service */ public static URL getUrl(Context context) { if (SunshinePreferences.isLocationLatLonAvailable(context)) { double[] preferredCoordinates = SunshinePreferences.getLocationCoordinates(context); double latitude = preferredCoordinates[0]; double longitude = preferredCoordinates[1]; return buildUrlWithLatitudeLongitude(latitude, longitude); } else { String locationQuery = SunshinePreferences.getPreferredWeatherLocation(context); return buildUrlWithLocationQuery(locationQuery); } }
/** * Retrieves the proper URL to query for the weather data. The reason for both this method as * well as {@link #buildUrlWithLocationQuery(String)} is two fold. * <p> * 1) You should be able to just use one method when you need to create the URL within the * app instead of calling both methods. * 2) Later in Sunshine, you are going to add an alternate method of allowing the user * to select their preferred location. Once you do so, there will be another way to form * the URL using a latitude and longitude rather than just a location String. This method * will "decide" which URL to build and return it. * * @param context used to access other Utility methods * @return URL to query weather service */ public static URL getUrl(Context context) { if (SunshinePreferences.isLocationLatLonAvailable(context)) { double[] preferredCoordinates = SunshinePreferences.getLocationCoordinates(context); double latitude = preferredCoordinates[0]; double longitude = preferredCoordinates[1]; return buildUrlWithLatitudeLongitude(latitude, longitude); } else { String locationQuery = SunshinePreferences.getPreferredWeatherLocation(context); return buildUrlWithLocationQuery(locationQuery); } }
/** * Retrieves the proper URL to query for the weather data. The reason for both this method as * well as {@link #buildUrlWithLocationQuery(String)} is two fold. * <p> * 1) You should be able to just use one method when you need to create the URL within the * app instead of calling both methods. * 2) Later in Sunshine, you are going to add an alternate method of allowing the user * to select their preferred location. Once you do so, there will be another way to form * the URL using a latitude and longitude rather than just a location String. This method * will "decide" which URL to build and return it. * * @param context used to access other Utility methods * @return URL to query weather service */ public static URL getUrl(Context context) { if (SunshinePreferences.isLocationLatLonAvailable(context)) { double[] preferredCoordinates = SunshinePreferences.getLocationCoordinates(context); double latitude = preferredCoordinates[0]; double longitude = preferredCoordinates[1]; return buildUrlWithLatitudeLongitude(latitude, longitude); } else { String locationQuery = SunshinePreferences.getPreferredWeatherLocation(context); return buildUrlWithLocationQuery(locationQuery); } }
/** * Retrieves the proper URL to query for the weather data. The reason for both this method as * well as {@link #buildUrlWithLocationQuery(String)} is two fold. * <p> * 1) You should be able to just use one method when you need to create the URL within the * app instead of calling both methods. * 2) Later in Sunshine, you are going to add an alternate method of allowing the user * to select their preferred location. Once you do so, there will be another way to form * the URL using a latitude and longitude rather than just a location String. This method * will "decide" which URL to build and return it. * * @param context used to access other Utility methods * @return URL to query weather service */ public static URL getUrl(Context context) { if (SunshinePreferences.isLocationLatLonAvailable(context)) { double[] preferredCoordinates = SunshinePreferences.getLocationCoordinates(context); double latitude = preferredCoordinates[0]; double longitude = preferredCoordinates[1]; return buildUrlWithLatitudeLongitude(latitude, longitude); } else { String locationQuery = SunshinePreferences.getPreferredWeatherLocation(context); return buildUrlWithLocationQuery(locationQuery); } }
/** * Retrieves the proper URL to query for the weather data. The reason for both this method as * well as {@link #buildUrlWithLocationQuery(String)} is two fold. * <p> * 1) You should be able to just use one method when you need to create the URL within the * app instead of calling both methods. * 2) Later in Sunshine, you are going to add an alternate method of allowing the user * to select their preferred location. Once you do so, there will be another way to form * the URL using a latitude and longitude rather than just a location String. This method * will "decide" which URL to build and return it. * * @param context used to access other Utility methods * @return URL to query weather service */ public static URL getUrl(Context context) { if (SunshinePreferences.isLocationLatLonAvailable(context)) { double[] preferredCoordinates = SunshinePreferences.getLocationCoordinates(context); double latitude = preferredCoordinates[0]; double longitude = preferredCoordinates[1]; return buildUrlWithLatitudeLongitude(latitude, longitude); } else { String locationQuery = SunshinePreferences.getPreferredWeatherLocation(context); return buildUrlWithLocationQuery(locationQuery); } }
/** * Retrieves the proper URL to query for the weather data. The reason for both this method as * well as {@link #buildUrlWithLocationQuery(String)} is two fold. * <p> * 1) You should be able to just use one method when you need to create the URL within the * app instead of calling both methods. * 2) Later in Sunshine, you are going to add an alternate method of allowing the user * to select their preferred location. Once you do so, there will be another way to form * the URL using a latitude and longitude rather than just a location String. This method * will "decide" which URL to build and return it. * * @param context used to access other Utility methods * @return URL to query weather service */ public static URL getUrl(Context context) { if (SunshinePreferences.isLocationLatLonAvailable(context)) { double[] preferredCoordinates = SunshinePreferences.getLocationCoordinates(context); double latitude = preferredCoordinates[0]; double longitude = preferredCoordinates[1]; return buildUrlWithLatitudeLongitude(latitude, longitude); } else { String locationQuery = SunshinePreferences.getPreferredWeatherLocation(context); return buildUrlWithLocationQuery(locationQuery); } }
/** * Retrieves the proper URL to query for the weather data. The reason for both this method as * well as {@link #buildUrlWithLocationQuery(String)} is two fold. * <p> * 1) You should be able to just use one method when you need to create the URL within the * app instead of calling both methods. * 2) Later in Sunshine, you are going to add an alternate method of allowing the user * to select their preferred location. Once you do so, there will be another way to form * the URL using a latitude and longitude rather than just a location String. This method * will "decide" which URL to build and return it. * * @param context used to access other Utility methods * @return URL to query weather service */ public static URL getUrl(Context context) { if (SunshinePreferences.isLocationLatLonAvailable(context)) { double[] preferredCoordinates = SunshinePreferences.getLocationCoordinates(context); double latitude = preferredCoordinates[0]; double longitude = preferredCoordinates[1]; return buildUrlWithLatitudeLongitude(latitude, longitude); } else { String locationQuery = SunshinePreferences.getPreferredWeatherLocation(context); return buildUrlWithLocationQuery(locationQuery); } }
/** * Retrieves the proper URL to query for the weather data. The reason for both this method as * well as {@link #buildUrlWithLocationQuery(String)} is two fold. * <p> * 1) You should be able to just use one method when you need to create the URL within the * app instead of calling both methods. * 2) Later in Sunshine, you are going to add an alternate method of allowing the user * to select their preferred location. Once you do so, there will be another way to form * the URL using a latitude and longitude rather than just a location String. This method * will "decide" which URL to build and return it. * * @param context used to access other Utility methods * @return URL to query weather service */ public static URL getUrl(Context context) { if (SunshinePreferences.isLocationLatLonAvailable(context)) { double[] preferredCoordinates = SunshinePreferences.getLocationCoordinates(context); double latitude = preferredCoordinates[0]; double longitude = preferredCoordinates[1]; return buildUrlWithLatitudeLongitude(latitude, longitude); } else { String locationQuery = SunshinePreferences.getPreferredWeatherLocation(context); return buildUrlWithLocationQuery(locationQuery); } }
/** * Retrieves the proper URL to query for the weather data. The reason for both this method as * well as {@link #buildUrlWithLocationQuery(String)} is two fold. * <p> * 1) You should be able to just use one method when you need to create the URL within the * app instead of calling both methods. * 2) Later in Sunshine, you are going to add an alternate method of allowing the user * to select their preferred location. Once you do so, there will be another way to form * the URL using a latitude and longitude rather than just a location String. This method * will "decide" which URL to build and return it. * * @param context used to access other Utility methods * @return URL to query weather service */ public static URL getUrl(Context context) { if (SunshinePreferences.isLocationLatLonAvailable(context)) { double[] preferredCoordinates = SunshinePreferences.getLocationCoordinates(context); double latitude = preferredCoordinates[0]; double longitude = preferredCoordinates[1]; return buildUrlWithLatitudeLongitude(latitude, longitude); } else { String locationQuery = SunshinePreferences.getPreferredWeatherLocation(context); return buildUrlWithLocationQuery(locationQuery); } }
/** * Retrieves the proper URL to query for the weather data. The reason for both this method as * well as {@link #buildUrlWithLocationQuery(String)} is two fold. * <p> * 1) You should be able to just use one method when you need to create the URL within the * app instead of calling both methods. * 2) Later in Sunshine, you are going to add an alternate method of allowing the user * to select their preferred location. Once you do so, there will be another way to form * the URL using a latitude and longitude rather than just a location String. This method * will "decide" which URL to build and return it. * * @param context used to access other Utility methods * @return URL to query weather service */ public static URL getUrl(Context context) { if (SunshinePreferences.isLocationLatLonAvailable(context)) { double[] preferredCoordinates = SunshinePreferences.getLocationCoordinates(context); double latitude = preferredCoordinates[0]; double longitude = preferredCoordinates[1]; return buildUrlWithLatitudeLongitude(latitude, longitude); } else { String locationQuery = SunshinePreferences.getPreferredWeatherLocation(context); return buildUrlWithLocationQuery(locationQuery); } }