I should have explicitly mentioned that on the interval `[0,2],` you integrate `x^2/2` , and get 2.
Your mistake is integrating `x^2/2` on the entire interval `[-2,2].` The derivative of `x^2/2` is `x,` which equals `|x|` only when `x>0.` What you have to do is break up the interval into the two intervals `[-2,0]` and `[0,2]`. On the first interval, since `x<=0,` `|x|=-x,` so the antiderivative we should use is `-x^2/2.` Thus
It looks like you know the basic idea so I won't complete all the details, but basically you should have ended up with
`1/4(2+2)=1` instead of `1/4(2-2).` Your method found the average value of `y=x` on the interval, which is of course 0.
I should add that while you should get practice using calculus to solve this, you can check it by using basic geometry. It really boils down to finding areas of triangles, and you can see by the graph that the average value is 1. Here's the graph of the function and its average value in red.