Code example for URLSpan

0
     * @param linkUri the link {@link Uri}. 
     */ 
    public static final void setTextToLink(TextView textView, CharSequence linkText, Uri linkUri) {
        String url = linkUri.toString();
        SpannableString text = new SpannableString(linkText);
        Object span = new URLSpan(url);
        text.setSpan(span, 0, linkText.length(), 0);
        textView.setText(text);
        addLinkMovementMethod(textView);
    } 
 
    public static final void setTextToLink(TextView textView, CharSequence linkText, Intent intent) {
        SpannableString text = new SpannableString(linkText);
        Object span = new IntentSpan(intent);
        text.setSpan(span, 0, linkText.length(), 0);
        textView.setText(text);
        addLinkMovementMethod(textView);
    } 
 
    public static boolean isPlaylistStreamingSupported(Context context, String type) {
Stop searching for code, let great code find you!  Add Codota to your java IDE