SunshineWeatherUtils.java 文件源码

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

项目:android-dev-challenge 作者:
/**
 * This method will format the temperatures to be displayed in the
 * following form: "HIGH° / LOW°"
 *
 * @param context Android Context to access preferences and resources
 * @param high    High temperature for a day in user's preferred units
 * @param low     Low temperature for a day in user's preferred units
 *
 * @return String in the form: "HIGH° / LOW°"
 */
public static String formatHighLows(Context context, double high, double low) {
    long roundedHigh = Math.round(high);
    long roundedLow = Math.round(low);

    String formattedHigh = formatTemperature(context, roundedHigh);
    String formattedLow = formatTemperature(context, roundedLow);

    String highLowStr = formattedHigh + " / " + formattedLow;
    return highLowStr;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号