Udostępnij za pośrednictwem


ClipData.Item.CoerceToText(Context) Method

Definition

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

public string CoerceToText (Android.Content.Context context);
member this.CoerceToText : 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 textual representation.

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