Code example for ImageSpan

0
        Drawable searchIcon = getContext().getResources().getDrawable(getSearchIconId());
        int textSize = (int) (mQueryTextView.getTextSize() * 1.25);
        searchIcon.setBounds(0, 0, textSize, textSize);
        ssb.setSpan(new ImageSpan(searchIcon), 1, 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        return ssb;
    } 
 
    private void updateQueryHint() { 
        if (mQueryHint != null) {
            mQueryTextView.setHint(getDecoratedHint(mQueryHint));
        } else { 
            mQueryTextView.setHint(getDecoratedHint(""));
        } 
    }     
 
    private final OnEditorActionListener mOnEditorActionListener = new OnEditorActionListener() {
 
        /** 
         * Called when the input method default action key is pressed. 
         */ 
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {