public static Context wrap(final Context ctx, @StyleRes final int themeResId) {
        //Avoid wrapping already wrapped context's
        if (ctx instanceof ContextThemeWrapperWrapper) {
            final ContextThemeWrapperWrapper wrapperCtx = (ContextThemeWrapperWrapper) ctx;
            if (wrapperCtx.getThemeResId() == themeResId) {
                //ctx is already wrapped with correct themeResId -> just return
                return ctx;
            }
            //re-wrap with new themeResId
            return new ContextThemeWrapperWrapper(wrapperCtx.base, themeResId);
        }
        return new ContextThemeWrapperWrapper(ctx, themeResId);
    }
If given context is or wraps an Activity, this activity is returned,
Otherwise null is returned
main/src/main/java/cgeo/geocaching/ui/ViewUtils.java