Code example for ClipboardManager

Methods: setPrimaryClip

0
    } 
 
    private void copy(CharSequence text) {
        ClipboardManager clipboard =
                (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE);
        clipboard.setPrimaryClip(ClipData.newPlainText(null, text));
    } 
 
    public void onCreateContextMenu(ContextMenu menu, View v,
            ContextMenuInfo info) {
        // FIXME: This is copied over almost directly from BrowserActivity. 
        // Would like to find a way to combine the two (Bug 1251210). 
 
        WebView webview = (WebView) v;
        WebView.HitTestResult result = webview.getHitTestResult();
        if (result == null) {
            return; 
        } 
 
        int type = result.getType();
        switch (type) {