$X$ a CW complex is contractible if it's the union of an increasing sequence

I'm doing exercise 11 on page 358 in Hatcher:

Show that a CW complex is contractible if it is the union of an increasing sequence of subcomplexes $X_1 \subset X_2 \subset \dots$ such that each inclusion $X_i \hookrightarrow X_{i + 1}$ is nullhomotopic.

My solution:

Consider any continuous map $f: S^i \rightarrow X$. $S^i$ is compact so $f(S^i)$ is compact and therefore contained in a finite subcomplex $X^k$ for some $k$. $i_k: X^k \hookrightarrow X^{k+1}$ is null homotopic by assumption so $f = i \circ i_k \circ f$, where $i: X^{k+1} \hookrightarrow X$ is the inclusion, is null-homotopic. Therefore $\pi_i(X, x_0) = 0$ for all $i$ and all $x_0$.

Now I don't know how to do the last bit. How can I show that if $\pi_i(X, x_0) = 0$ then $X$ is contractible? Many thanks for your help!

-

Let $g$ be any map from a one-point space to $X$. Since both spaces have all homotopy groups trivial, $g$ induces an isomorphism on all the homotopy groups. Thus by Whitehead's theorem $g$ is a homotopy equivalence and so $X$ is contractible.
I take $x_0$ and the inclusion $i: \{ x_0 \} \hookrightarrow X$. $i_\ast$ is a map from zero to zero and is therefore an isomorphism and then by Whitehead a homotopy equivalence? –  Rudy the Reindeer Sep 7 '11 at 12:35