Code example for BackgroundColorSpan

0
			toReturn.setSpan(new ForegroundColorSpan(Color.GREEN), 0, Math.min(index, toReturn.length()), 0);
		} 
		 
		if (index < toReturn.length()) {
			toReturn.setSpan(new ForegroundColorSpan(Color.YELLOW), index, index + 1, 0);
			toReturn.setSpan(new BackgroundColorSpan(Color.BLACK), index, index + 1, 0);
		} 
		 
		if (index < toReturn.length() - 1) {
			toReturn.setSpan(new ForegroundColorSpan(Color.RED), index + 1, toReturn.length(), 0);
		} 
		 
		return toReturn;
		 
	} 
	 
} 
Experience pair programming with AI  Get Codota for Java