SunshinePreferences.java 文件源码

java
阅读 28 收藏 0 点赞 0 评论 0

项目:android-dev-challenge 作者:
/**
 * Returns true if the latitude and longitude values are available. The latitude and
 * longitude will not be available until the lesson where the PlacePicker API is taught.
 *
 * @param context used to get the SharedPreferences
 * @return true if lat/long are saved in SharedPreferences
 */
public static boolean isLocationLatLonAvailable(Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);

    boolean spContainLatitude = sp.contains(PREF_COORD_LAT);
    boolean spContainLongitude = sp.contains(PREF_COORD_LONG);

    boolean spContainBothLatitudeAndLongitude = false;
    if (spContainLatitude && spContainLongitude) {
        spContainBothLatitudeAndLongitude = true;
    }

    return spContainBothLatitudeAndLongitude;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号