Java tutorial
//package com.java2s; //License from project: Open Source License import android.net.Uri; import android.support.annotation.NonNull; public class Main { private static final String PATH_FORECAST = "forecast"; private static final String PATH_DAILY = "daily"; private static final String QUERY_CITY_ID = "id"; private static final String QUERY_COUNT = "cnt"; private static final int QUERY_DAILY_FORECAST_COUNT = 5; /** * Appends the middle part to the given uri builder and returns it * @param uriBuilder * @param cityId * @return */ @NonNull private static Uri.Builder appendMiddleToUriBuilder(@NonNull Uri.Builder uriBuilder, long cityId) { uriBuilder.appendPath(PATH_FORECAST).appendPath(PATH_DAILY) .appendQueryParameter(QUERY_CITY_ID, Long.toString(cityId)) .appendQueryParameter(QUERY_COUNT, Integer.toString(QUERY_DAILY_FORECAST_COUNT)); return uriBuilder; } }