Code example for ContextThemeWrapper

0
    } 
 
    public IcsListPopupWindow(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        mContext = context;
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
            Context wrapped = new ContextThemeWrapper(context, defStyleRes);
            mPopup = new PopupWindowCompat(wrapped, attrs, defStyleAttr);
        } else { 
            mPopup = new PopupWindowCompat(context, attrs, defStyleAttr, defStyleRes);
        } 
        mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
    } 
 
    public void setAdapter(ListAdapter adapter) {
        if (mObserver == null) {
            mObserver = new PopupDataSetObserver();
        } else if (mAdapter != null) {
            mAdapter.unregisterDataSetObserver(mObserver);
        } 
        mAdapter = adapter;
        if (mAdapter != null) {