Null pointer exception in android app
===

I have no idea why but I am getting null pointer exceptions wihin this code below this is only basic code but something is causing a null pointer exception as soon as the app is run and it says it is within MainActivity

public class MainActivity extends Activity implements OnClickListener{

	ImageView img1 = (ImageView) findViewById(R.id.ImageView01);
	ImageView img2 = (ImageView) findViewById(R.id.ImageView02);
	ImageView img3 = (ImageView) findViewById(R.id.ImageView03);
	ImageView img4 = (ImageView) findViewById(R.id.ImageView04);
	ImageView img5 = (ImageView) findViewById(R.id.ImageView05);
	ImageView img6 = (ImageView) findViewById(R.id.ImageView06);
	ImageView img7 = (ImageView) findViewById(R.id.ImageView07);
	ImageView img8 = (ImageView) findViewById(R.id.ImageView08);
	ImageView img9 = (ImageView) findViewById(R.id.ImageView09);
	int i = 0;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        img1.setOnClickListener(this);       
        img2.setOnClickListener(this);     
        img3.setOnClickListener(this); 
        img4.setOnClickListener(this);
        img5.setOnClickListener(this); 
        img6.setOnClickListener(this);
        img7.setOnClickListener(this);
        img8.setOnClickListener(this);
        img9.setOnClickListener(this);
        
        if(i == 8){
        	//show dialog
        	Toast.makeText(getApplicationContext(), "You clicked all 9", Toast.LENGTH_LONG).show();
        }
    }

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
        case R.id.ImageView01:
            // do something
        	img1.setVisibility(View.GONE);
        	i = i + 1;
            break;
        case R.id.ImageView02:
            // do something
        	img2.setVisibility(View.GONE);
        	i = i + 1;
            break;
        case R.id.ImageView03:
            // do something   	
        	img3.setVisibility(View.GONE);
        	i = i + 1;
            break;
        case R.id.ImageView04:
            // do something
        	img4.setVisibility(View.GONE);
        	i = i + 1;
            break;
        case R.id.ImageView05:
            // do something
        	img5.setVisibility(View.GONE);
        	i = i + 1;
            break;
        case R.id.ImageView06:
            // do something
        	img6.setVisibility(View.GONE);
        	i = i + 1;
            break;
        case R.id.ImageView07:
            // do something
        	img7.setVisibility(View.GONE);
        	i = i + 1;
            break;
        case R.id.ImageView08:
            // do something
        	img8.setVisibility(View.GONE);
        	i = i + 1;
            break;
        case R.id.ImageView09:
            // do something
        	img9.setVisibility(View.GONE);
        	i = i + 1;
            break;
		}
	}
 