ClipboardManager.OnPrimaryClipChangedListener onPrimaryClipChangedListener;
final ClipboardManager clipboardManager = (ClipboardManager)this.getSystemService(Context.CLIPBOARD_SERVICE);
onPrimaryClipChangedListener = new ClipboardManager.OnPrimaryClipChangedListener() {
@Override
public void onPrimaryClipChanged() {
if(clipboardManager.hasPrimaryClip() && clipboardManager.getPrimaryClip().getItemCount() > 0){
Toast.makeText(getApplicationContext(), clipboardManager.getPrimaryClip().getItemAt(0).getText(),Toast.LENGTH_LONG).show();
}
}
};
clipboardManager.addPrimaryClipChangedListener(onPrimaryClipChangedListener);
吃个魔方压压惊
- 发布:2018-12-10 14:55
- 更新:2022-06-09 11:30
- 阅读:1179
1 个回复
dafeizhu
请问解决了吗?