public static void setInitialsThumb ( Context context , TextView initialsView , String fullName ) { char initial1 = ' ' ; char initial2 = ' ' ; if ( fullName != null ) { String [ ] nameParts = fullName . split ( " " ) ; if ( nameParts [ 0 ] . length ( ) > 0 ) { initial1 = nameParts [ 0 ] . charAt ( 0 ) ; } if ( nameParts . length > 1 ) { initial2 = nameParts [ nameParts . length - 1 ] . charAt ( 0 ) ; } } setColorForInitialsThumb ( initialsView , initial1 + initial2 ) ; initialsView . setText ( initial1 + "" + initial2 ) ; initialsView . setTextColor ( Color . WHITE ) ; }
Helper method used to display initials into a given textview .