get Clipboard Text Legacy - Android android.content

Android examples for android.content:ClipboardManager

Description

get Clipboard Text Legacy

Demo Code

import android.content.Context;

public class Main {

   static String getClipboardTextLegacy(Context ctx) {
    String txt = null;//from w  ww . j a v  a  2 s .  c o  m
    android.text.ClipboardManager clipboard = (android.text.ClipboardManager) ctx
        .getSystemService(Context.CLIPBOARD_SERVICE);
    if (clipboard != null) {
      txt = clipboard.getText().toString();
    }
    return txt;
  }

}

Related Tutorials