FileDocCategorySizeDatePackage
ClipboardManager.javaAPI DocAndroid 1.5 API2509Wed May 06 22:41:56 BST 2009android.text

ClipboardManager

public class ClipboardManager extends Object
Interface to the clipboard service, for placing and retrieving text in the global clipboard.

You do not instantiate this class directly; instead, retrieve it through {@link android.content.Context#getSystemService}.

see
android.content.Context#getSystemService

Fields Summary
private static IClipboard
sService
private android.content.Context
mContext
Constructors Summary
public ClipboardManager(android.content.Context context, android.os.Handler handler)
{@hide}

        mContext = context;
    
Methods Summary
private static IClipboardgetService()

        if (sService != null) {
            return sService;
        }
        IBinder b = ServiceManager.getService("clipboard");
        sService = IClipboard.Stub.asInterface(b);
        return sService;
    
public java.lang.CharSequencegetText()
Returns the text on the clipboard. It will eventually be possible to store types other than text too, in which case this will return null if the type cannot be coerced to text.

        try {
            return getService().getClipboardText();
        } catch (RemoteException e) {
            return null;
        }
    
public booleanhasText()
Returns true if the clipboard contains text; false otherwise.

        try {
            return getService().hasClipboardText();
        } catch (RemoteException e) {
            return false;
        }
    
public voidsetText(java.lang.CharSequence text)
Sets the contents of the clipboard to the specified text.

        try {
            getService().setClipboardText(text);
        } catch (RemoteException e) {
        }