List of usage examples for android.content Context CLIPBOARD_SERVICE
String CLIPBOARD_SERVICE
To view the source code for android.content Context CLIPBOARD_SERVICE.
Click Source Link
From source file:com.codename1.impl.android.AndroidImplementation.java
/** * @inheritDoc//from ww w .ja va 2 s . c o m */ public Object getPasteDataFromClipboard() { if (getContext() == null) { return null; } final Object[] response = new Object[1]; runOnUiThreadAndBlock(new Runnable() { @Override public void run() { int sdk = android.os.Build.VERSION.SDK_INT; if (sdk < 11) { android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getActivity() .getSystemService(Context.CLIPBOARD_SERVICE); response[0] = clipboard.getText().toString(); } else { android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getActivity() .getSystemService(Context.CLIPBOARD_SERVICE); ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0); response[0] = item.getText(); } } }); return response[0]; }