Weak closedness implies closed and convex

Let $I=[0, 1]$, $1\leq p<+\infty$ and let $A$ be a non empty subset of $\mathbb R^n$. Denote with $S_p(A)$ the set of functions $u\in L^p(I,\mathbb R^n)$ such that $u(x)\in A$ for almost every $x\in I$. Is it true that if $S_p(A)$ is weakly closed in $L^p(I,\mathbb R^n)$ then $A$ is closed and convex?

-
Doesn't $A=\{0,1\}$ satisfy the hypothesis? – tomasz Sep 5 '12 at 16:09
how do you prove that, with your choice of $A$, $S_p(A)$ is weakly closed in $L^p(I,\mathbb R^n)$? – guido giuliani Sep 5 '12 at 16:24

$A$ is closed. If $x_n\in A$ converge to $x\in \mathbb R^n$, then the constant functions $f_n\equiv x_n$ converge in $L^p$ to $x$. Hence $x\in A$.
$A$ is midpoint-convex. Given $a,b\in A$, let $f_n(x)=a$ if $\lfloor nx\rfloor$ is even, and $f_n(x)=b$ otherwise. This sequence converges weakly in $L^p$ to the constant function $f\equiv (a+b)/2$. To prove this, first show that $\int_J f_n \to\int_J f$ for every subinterval $J\subset I$, and then use the density of step functions in $(L^p)^*=L^q$.
Since $A$ is closed and midpoint-convex, it is convex.