get Current Clip Content from Clipboard - Android Android OS

Android examples for Android OS:Clipboard

Description

get Current Clip Content from Clipboard

Demo Code


//package com.java2s;
import android.content.Context;
import android.text.ClipboardManager;

public class Main {
    public static String getCurrentClipContent(Context context) {
        ClipboardManager clipboardManager = (ClipboardManager) context
                .getSystemService(Context.CLIPBOARD_SERVICE);
        return clipboardManager.getText() == null ? null : clipboardManager
                .getText().toString();//from   w  w  w . ja va 2s  .c o m
    }
}

Related Tutorials