Code example for UnderlineSpan

0
	public void setInTextStyle(char tag, int start, int end){
		SpannableString textString;
		textString=  new SpannableString(text.getText());
		if((textString.length()>=end)&&(end>start)){										//Check the tag chosen and sets the segment of String to the chosen tag using start and end values of the string. Flag integer is always set to 0.
			if(tag=='u')
					textString.setSpan(new UnderlineSpan(), start, end, 0);
			else if(tag=='b')
					textString.setSpan(new StyleSpan(Typeface.BOLD), start, end, 0);
			else if(tag=='i')
					textString.setSpan(new StyleSpan(Typeface.ITALIC), start, end, 0);		
			text.setText(textString);
		} 
		else 
			System.out.println("TextHandler module, method setInTextStyle says: Input is not correct");
		 
	} 
	 
	//Method to set colour using hext integer AARRGGBB 
	public void setColourIntAARRGGBB(int inColourHex){
		Paint paint = new Paint();
        String colourString, colourAlphaString, colourRedString, colourGreenString, colourBlueString;	//variables used for separation of integer to 4 integer values of Alpha, Red, Green and Blue