I'm developping an android application, and a need to copy text (from listView item) to the clipboard in order to paste it in an editText.
So copy function looks like :
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setText("String to copy");
However, an exception is fired on the first line :
04-12 15:08:59.101:
E/AndroidRuntime(25406): java.lang.NoClassDefFoundError: android.content.ClipboardManager
I've googled it, but i found no working answers.
Thanks for replies
Check the package of ClipboardManager.
One is from android.text package, and the other is from android.content package.
android.content.ClipboardManager is only available on API level 11 and up. I am guessing thats the reason for this error.
So, you for running your code on older phones, you should use android.text.ClipboardManager
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