I'm using a Samsung Galaxy S2 and tried the following:
import android.text.ClipboardManager;
ClipboardManager clipboard = (ClipboardManager)context.getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setText(null);
and
clipboard.setText("");
It didn't work. Ideas?
Their is a bug with the Samsung Galaxy. It doesn't accept setting the clipboard to a blank value. You could try setting it to a space instead.
clipboard.setText(" ");
For further information check this
Have you tried .setPrimaryClip(ClipData clip)? The documentation reads:
public void setPrimaryClip (ClipData clip)
Since: API Level 11 Sets the current primary clip on the clipboard. This is the clip that is involved in normal cut and paste operations. Parameters
clip The clipped data item to set.
According to the docs, setText() is deprecated.
I know this question is old, but it's worth a try.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With