Android examples for android.content:Clipboard
Try Get Text From Clipboard
import android.content.Context; import android.text.ClipboardManager; public class Main{ public static boolean TryGetTextFromClipboard(Context context, Holder<String> text) { try {/*from www. ja v a 2 s . c o m*/ ClipboardManager clipboard = (ClipboardManager) context .getSystemService(Context.CLIPBOARD_SERVICE); if (clipboard != null) { CharSequence clipboardText = clipboard.getText(); if (clipboardText != null && clipboardText.length() > 0) { String textResult = clipboardText.toString(); if (!textResult.startsWith("intent")) { text.value = textResult; return true; } } } } catch (Exception e) { } return false; } }