List of usage examples for android.text ClipboardManager getText
public abstract CharSequence getText();
From source file:Main.java
public static String getFromClipboard(Context context) { ClipboardManager c = (ClipboardManager) context.getSystemService(Activity.CLIPBOARD_SERVICE); return c.getText().toString(); }
From source file:Main.java
public static String getCurrentClipContent(Context context) { ClipboardManager clipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); return clipboardManager.getText() == null ? null : clipboardManager.getText().toString(); }
From source file:Main.java
public static String getCopy(Context context) { try {//ww w . j a v a2s. c o m ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); return cmb.getText().toString(); } catch (Exception e) { } return " "; }
From source file:Main.java
@SuppressWarnings("deprecation") public static String getText4Clipboard(Context context) { ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); if (cm != null && cm.getText() != null) { return cm.getText().toString(); }/*from ww w.j av a 2s. co m*/ return ""; }
From source file:Main.java
public static final int clipboardTextLength(Context context) { ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); CharSequence text = cm != null ? cm.getText() : null; return text != null ? text.length() : 0; }
From source file:Main.java
@SuppressWarnings("deprecation") public static String getClipboard(Context context) { android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context .getSystemService(Context.CLIPBOARD_SERVICE); return clipboard.getText().toString(); }
From source file:Main.java
/** * This is only called when we are on API level < Honeycomb * @param context The context, required to get the Cliboard System Service. * @return Returns the latest text copied to the clipboard by the user *//*from www . j a v a2 s . co m*/ @SuppressWarnings("deprecation") private static String getTextFromClipboard(final Context context) { android.text.ClipboardManager manager = (android.text.ClipboardManager) context .getSystemService(Context.CLIPBOARD_SERVICE); String text = (String) manager.getText(); //Yep, that much simpler. if (text == null) text = EMPTY_STRING; return text; }
From source file:Main.java
@SuppressWarnings("deprecation") private static String getClipboardTextLegacy(Context ctx) { String txt = null;/* w ww.j a va 2s. c om*/ android.text.ClipboardManager clipboard = (android.text.ClipboardManager) ctx .getSystemService(Context.CLIPBOARD_SERVICE); if (clipboard != null) { txt = clipboard.getText().toString(); } return txt; }
From source file:de.kodejak.hashr.fragmentHashFromText.java
public void OnButtonFromClipboardClick() { EditText txtOutput = (EditText) getView().findViewById(R.id.edCompare); ClipboardManager clipboard = (ClipboardManager) mContext.getSystemService(Context.CLIPBOARD_SERVICE); CharSequence hash = clipboard.getText(); String out = (String) hash; if (trimHash) out = out.trim();/*w w w. ja v a 2 s. c o m*/ if (uppercaseHash) { out = out.toUpperCase(); } txtOutput.setText(out); }
From source file:de.kodejak.hashr.fragmentHashFromFile.java
public void OnButtonFromClipboardClick() { EditText txtOutput = (EditText) getView().findViewById(R.id.edCompare); ClipboardManager clipboard = (ClipboardManager) mContext.getSystemService(Context.CLIPBOARD_SERVICE); CharSequence hash = clipboard.getText(); String out = (String) hash; if (trimHash) out = out.trim();/*from w ww.java2 s .co m*/ if (uppercaseHash) out = out.toUpperCase(); txtOutput.setText(out); }