over 7 years ago
If you are looking to copy the text from android widgets to clipboard, you can use the below code
TextView contentTextBox=(TextView) findViewById(R.id.tv_content); //get textview from which you want to copy the content String textToCopy = contentTextBox.getText().toString(); if(textToCopy.length() != 0) { if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) // check sdk version { android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setText(textToCopy); Toast.makeText(getApplicationContext(), "Copied to Clipboard", Toast.LENGTH_SHORT).show(); } else { android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemServic(Context.CLIPBOARD_SERVICE); android.content.ClipData clipData = android.content.ClipData.newPlainText("Clip",textToCopy); Toast.makeText(getApplicationContext(), "Copied to Clipboard", Toast.LENGTH_SHORT).show(); clipboard.setPrimaryClip(clipData); } } else { Toast.makeText(getApplicationContext(), "Empty Selection", Toast.LENGTH_SHORT).show(); }
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Sign up using
0 Comment(s)