有人能告诉我如何复制在一个特定的文本视图到剪贴板,当一个按钮被按下?
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mainpage);
textView = (TextView) findViewById(R.id.textview);
copyText = (Button) findViewById(R.id.bCopy);
copyText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
String getstring = textView.getText().toString();
// Help to continue :)
}
});
}
我想复制文本在TextView TextView到剪贴板时,按钮bCopy按下。