Code example for StyleSpan

0
     * @param result The result to highlight 
     * @return CharSequence The non highlighted name string 
     */ 
    public static CharSequence getNonHighlightedName(SearchResult result) {
        String name = result.getFso().getName();
        Spannable span = new SpannableString(name);
        span.setSpan(new StyleSpan(Typeface.BOLD), 0, name.length(), 0);
        return span;
    } 
 
    /** 
     * Method that converts the list of file system object to a search result. 
     * 
     * @param files The files to convert 
     * @param queries The terms of the search 
     * @return List<SearchResult> The files converted 
     */ 
    public static List<SearchResult> convertToResults(List<FileSystemObject> files, Query queries) {
        //Converts the list of files in a list of search results 
        List<SearchResult> results = new ArrayList<SearchResult>(files.size());
        int cc = files.size();