IT. Expert System.

Android Reference

ClipData.Item


android.content

Class ClipData.Item

  • Enclosing class:
    ClipData


    public static class ClipData.Item
    extends Object
    Description of a single item in a ClippedData.

    The types than an individual item can currently contain are:

    • Text: a basic string of text. This is actually a CharSequence, so it can be formatted text supported by corresponding Android built-in style spans. (Custom application spans are not supported and will be stripped when transporting through the clipboard.)
    • Intent: an arbitrary Intent object. A typical use is the shortcut to create when pasting a clipped item on to the home screen.
    • Uri: a URI reference. This may be any URI (such as an http: URI representing a bookmark), however it is often a content: URI. Using content provider references as clips like this allows an application to share complex or large clips through the standard content provider facilities.
    • Constructor Detail

      • ClipData.Item

        public ClipData.Item(CharSequence text)
        Create an Item consisting of a single block of (possibly styled) text.
      • ClipData.Item

        public ClipData.Item(CharSequence text,
                     String htmlText)
        Create an Item consisting of a single block of (possibly styled) text, with an alternative HTML formatted representation. You must supply a plain text representation in addition to HTML text; coercion will not be done from HTML formated text into plain text.
      • ClipData.Item

        public ClipData.Item(Intent intent)
        Create an Item consisting of an arbitrary Intent.
      • ClipData.Item

        public ClipData.Item(Uri uri)
        Create an Item consisting of an arbitrary URI.
      • ClipData.Item

        public ClipData.Item(CharSequence text,
                     Intent intent,
                     Uri uri)
        Create a complex Item, containing multiple representations of text, Intent, and/or URI.
      • ClipData.Item

        public ClipData.Item(CharSequence text,
                     String htmlText,
                     Intent intent,
                     Uri uri)
        Create a complex Item, containing multiple representations of text, HTML text, Intent, and/or URI. If providing HTML text, you must supply a plain text representation as well; coercion will not be done from HTML formated text into plain text.
    • Method Detail

      • getText

        public CharSequence getText()
        Retrieve the raw text contained in this Item.
      • getHtmlText

        public String getHtmlText()
        Retrieve the raw HTML text contained in this Item.
      • getIntent

        public Intent getIntent()
        Retrieve the raw Intent contained in this Item.
      • getUri

        public Uri getUri()
        Retrieve the raw URI contained in this Item.
      • coerceToText

        public CharSequence coerceToText(Context context)
        Turn this item into text, regardless of the type of data it actually contains.

        The algorithm for deciding what text to return is:

        • If getText() is non-null, return that.
        • 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.
        • If getIntent() is non-null, convert that to an intent: URI and return it.
        • Otherwise, return an empty string.
        Parameters:
        context - The caller's Context, from which its ContentResolver and other things can be retrieved.
        Returns:
        Returns the item's textual representation.
      • coerceToStyledText

        public CharSequence coerceToStyledText(Context context)
        Like coerceToHtmlText(Context), but any text that would be returned as HTML formatting will be returned as text with style spans.
        Parameters:
        context - The caller's Context, from which its ContentResolver and other things can be retrieved.
        Returns:
        Returns the item's textual representation.
      • coerceToHtmlText

        public String coerceToHtmlText(Context context)
        Turn this item into HTML text, regardless of the type of data it actually contains.

        The algorithm for deciding what text to return is:

        • If getHtmlText() is non-null, return that.
        • If getText() is non-null, return that, converting to valid HTML text. If this text contains style spans, Html.toHtml(Spanned) is used to convert them to HTML formatting.
        • 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.
        • If getIntent() is non-null, convert that to an intent: URI and return as an HTML link.
        • Otherwise, return an empty string.
        Parameters:
        context - The caller's Context, from which its ContentResolver and other things can be retrieved.
        Returns:
        Returns the item's representation as HTML text.
      • toString

        public String toString()
        Description copied from class: Object
        Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
           getClass().getName() + '@' + Integer.toHexString(hashCode())

        See Writing a useful toString method if you intend implementing your own toString method.

        Overrides:
        toString in class Object
        Returns:
        a printable representation of this object.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 349 / . Delta: 0.04750 с