Say, you have a TextView namely etx, use the following code:
 final SpannableStringBuilder sb = new SpannableStringBuilder("HELLOO");
        final StyleSpan bss = new StyleSpan(android.graphics.Typeface.BOLD); // Span to make text bold
        final StyleSpan iss = new StyleSpan(android.graphics.Typeface.ITALIC);Span to make text italic
        sb.setSpan(bss, 0, 4, Spannable.SPAN_INCLUSIVE_INCLUSIVE); // make first 4 characters Bold 
        sb.setSpan(iss, 4, 6, Spannable.SPAN_INCLUSIVE_INCLUSIVE); // make last 2 characters Italic
        etx.setText(sb);
The main advantage of using this approach is that you can format text dynamically.