Partager via


ClipData.Item.CoerceToHtmlText(Context) Method

Definition

Turn this item into HTML text, regardless of the type of data it actually contains.

[Android.Runtime.Register("coerceToHtmlText", "(Landroid/content/Context;)Ljava/lang/String;", "GetCoerceToHtmlText_Landroid_content_Context_Handler")]
public virtual string CoerceToHtmlText (Android.Content.Context context);
[<Android.Runtime.Register("coerceToHtmlText", "(Landroid/content/Context;)Ljava/lang/String;", "GetCoerceToHtmlText_Landroid_content_Context_Handler")>]
abstract member CoerceToHtmlText : Android.Content.Context -> string
override this.CoerceToHtmlText : Android.Content.Context -> string

Parameters

context
Context

The caller's Context, from which its ContentResolver and other things can be retrieved.

Returns

Returns the item's representation as HTML text.

Attributes

Remarks

Turn this item into HTML text, regardless of the type of data it actually contains.

The algorithm for deciding what text to return is: <ul> <li> If #getHtmlText is non-null, return that. <li> If #getText is non-null, return that, converting to valid HTML text. If this text contains style spans, Html#toHtml(Spanned) Html.toHtml(Spanned) is used to convert them to HTML formatting. <li> If #getUri is non-null, try to retrieve its data as a text stream from its content provider. If the provider can supply text/html data, that will be preferred and returned as-is. Otherwise, any text/* data will be returned and escaped to HTML. If it is not a content: URI or the content provider does not supply a text representation, HTML text containing a link to the URI will be returned. <li> If #getIntent is non-null, convert that to an intent: URI and return as an HTML link. <li> Otherwise, return an empty string. </ul>

Java documentation for android.content.ClipData.Item.coerceToHtmlText(android.content.Context).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to