Partager via


ClipData.Item.CoerceToTextFormatted(Context) Method

Definition

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

[Android.Runtime.Register("coerceToText", "(Landroid/content/Context;)Ljava/lang/CharSequence;", "GetCoerceToText_Landroid_content_Context_Handler")]
public virtual Java.Lang.ICharSequence CoerceToTextFormatted (Android.Content.Context context);
[<Android.Runtime.Register("coerceToText", "(Landroid/content/Context;)Ljava/lang/CharSequence;", "GetCoerceToText_Landroid_content_Context_Handler")>]
abstract member CoerceToTextFormatted : Android.Content.Context -> Java.Lang.ICharSequence
override this.CoerceToTextFormatted : Android.Content.Context -> Java.Lang.ICharSequence

Parameters

context
Context

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

Returns

Returns the item's textual representation.

Attributes

Remarks

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

The algorithm for deciding what text to return is: <ul> <li> If #getText is non-null, return that. <li> If #getUri is non-null, try to retrieve its data as a text stream from its content provider. If this succeeds, copy the text into a String and return it. If it is not a content: URI or the content provider does not supply a text representation, return the raw URI as a string. <li> If #getIntent is non-null, convert that to an intent: URI and return it. <li> Otherwise, return an empty string. </ul>

Java documentation for android.content.ClipData.Item.coerceToText(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