ClipboardManager clipboardManager = (ClipboardManager)getSystemService(CLIPBOARD_SERVICE);
if (clipboardManager.hasText()) {
Toast.makeText(getApplicationContext(),
"Clipboard Text = " + clipboardManager.getText().toString(),
Toast.LENGTH_LONG).show();
clipboardManager.setText(null);
} else {
Toast.makeText(getApplicationContext(),
"No Content in Clipboard. So set some text in clipboard",
Toast.LENGTH_LONG).show();
clipboardManager.setText("AndroidPeople.com");
Toast.makeText(getApplicationContext(),
"Clipboard Text = " + clipboardManager.getText().toString(),
Toast.LENGTH_LONG).show();
}