I have a textView and I made its text copyable and then Override onCreateContextMenu:
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
//user has long pressed your TextView
menu.add(0, v.getId(), 0, "Copy");
TextView yourTextView = (TextView) v;
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
clipboard.setText(yourTextView.getText());
}
I want to show toast "copied to clipboard" after menu is clicked, how can I do that? And my second question is why ClipManager is deprecated? what to use instead?