get Popular Artists URL from spotify - Android Network

Android examples for Network:URL

Description

get Popular Artists URL from spotify

Demo Code


import android.net.Uri;

public class Main{
    private static final String BASE_URL = "https://api.spotify.com/v1/";
    private static final String SEARCH_URL = "search";
    private static final String OFFSET = "offset";
    private static final String LIMIT = "limit";
    private static final String MARKET = "market";
    private static final String QUERY = "q";
    private static final String YEAR = "year:";
    private static final String TYPE = "type";
    public static String getPopularArtistsURL(int offset, int limit,
            String market, String year) {
        Uri.Builder uriBuilder = Uri.parse(BASE_URL).buildUpon()
                .appendPath(SEARCH_URL)
                .appendQueryParameter(LIMIT, "" + limit)
                .appendQueryParameter(OFFSET, "" + offset)
                .appendQueryParameter(MARKET, market)
                .appendQueryParameter(QUERY, YEAR + year)
                .appendQueryParameter(TYPE, "artist");

        return uriBuilder.build().toString();
    }//from  w  ww  .j  a v  a 2s  .co  m
}

Related Tutorials