var Context = plus.android.importClass("android.content.Context");
var InputMethodManager = plus.android.importClass("android.content.ClipboardManager");
var main = plus.android.runtimeMainActivity();
var imm = main.getSystemService(Context.CLIPBOARD_SERVICE);
var clipData = imm.getPrimaryClip().getText();
我是这么弄得 但是这么做获取不到啊
吃个魔方压压惊
请问一下,我想监听一下剪切板 java代码写好了,NJS该怎么写呢
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:48