Java tutorial
//package com.java2s; //License from project: Open Source License import android.annotation.TargetApi; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.os.Build; public class Main { @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static String getText(Context context) { final ClipboardManager clipboard = getClipboard(context); final ClipData clipData = clipboard.getPrimaryClip(); return clipData.getItemAt(0).getText().toString(); } private static ClipboardManager getClipboard(Context context) { return (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); } }