Code example for ClipboardManager

Methods: hasPrimaryClip

0
 
    private boolean canPaste() { 
        ClipboardManager clipMgr = (ClipboardManager)
                getContext().getSystemService(Context.CLIPBOARD_SERVICE);
        return clipMgr.hasPrimaryClip();
    } 
 
    private boolean isShareHandlerAvailable() { 
        Intent intent = new Intent(Intent.ACTION_SEND);
        intent.setType("text/plain");
        return getContext().getPackageManager()
                .queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY).size() > 0;
    } 
 
    private boolean isWebSearchAvailable() { 
        Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
        intent.putExtra(SearchManager.EXTRA_NEW_SEARCH, true);
        return getContext().getPackageManager()
                .queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY).size() > 0;
    } 
}