Code example for Intent

Methods: setComponent

     * 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);
        List<ResolveInfo> activities = queryIntentActivities(intent,
        if (activities != null && !activities.isEmpty()) {
            return true; 
        return false; 
    private static final Comparator<ResolveInfo> GLOBAL_SEARCH_RANKER =
            new Comparator<ResolveInfo>() {