Have you ever tried to follow the Android programming tutorials at developer.android.com?
The writer gives too much for granted, many examples do not work as written if you copy them with a simple copy&paste. To permit a simplified view of the code, the header is omitted and the overall vision of how methods and classes are placed is not very clear.
You might end up with errors as:
array cannot be resolved or is not a field
or
The method setOnItemClickListener(AdapterView.OnItemClickListener) in the type AdapterView<ListAdapter> is not applicable for the arguments (new OnItemClickListener(){})
etcetera.
So, I created a public Bitbucket repository where beginners can go and compare the code.