Java tutorial
//package com.java2s; //License from project: Open Source License import android.text.TextUtils; import java.util.Locale; public class Main { public static final String MAPBOX_BASE_URL_V4 = "https://a.tiles.mapbox.com/v4/"; public static String markerIconURL(String accessToken, String size, String symbol, String color) { // Make a string which follows the Mapbox Core API spec for stand-alone markers. This relies on the Mapbox API // for error checking. StringBuffer marker = new StringBuffer("pin-"); final String lowerCaseSize = size.toLowerCase(Locale.US); if (lowerCaseSize.charAt(0) == 'l') { marker.append("l"); // large } else if (lowerCaseSize.charAt(0) == 's') { marker.append("s"); // small } else { marker.append("m"); // default to medium } if (!TextUtils.isEmpty(symbol)) { marker.append(String.format("-%s+", symbol)); } else { marker.append("+"); } marker.append(color.replaceAll("#", "")); // if (AppUtils.isRunningOn2xOrGreaterScreen(context)) { // marker.append("@2x"); // } marker.append(".png"); marker.append("?access_token="); marker.append(accessToken); return String.format(Locale.US, MAPBOX_BASE_URL_V4 + "marker/%s", marker); } }