Code example for Intent

Methods: setComponent

0
     * Checks whether the global search provider with a given 
     * component name is installed on the system or not. This deals with 
     * cases such as the removal of an installed provider. 
     */ 
    private boolean isInstalled(ComponentName globalSearch) {
        Intent intent = new Intent(SearchManager.INTENT_ACTION_GLOBAL_SEARCH);
        intent.setComponent(globalSearch);
 
        List<ResolveInfo> activities = queryIntentActivities(intent,
                PackageManager.MATCH_DEFAULT_ONLY);
        if (activities != null && !activities.isEmpty()) {
            return true; 
        } 
 
        return false; 
    } 
 
    private static final Comparator<ResolveInfo> GLOBAL_SEARCH_RANKER =
            new Comparator<ResolveInfo>() { 
        @Override 
        public int compare(ResolveInfo lhs, ResolveInfo rhs) {