You can download optional “samples for SDK” from within the Android SDK Manager. This code is placed in the sdk/samples folders, under each specific api level.
Building Sample Code
open Eclipse
go to File → New → Project
Android → Android Sample Project
Select an API Level
Select a Sample Project
right click project, Debug As → Android Application