I am very new to Android Development. I am trying a sample application and it is generating a button dynamically using Java and it is working fine.
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    btn=new Button(this);
    btn.setOnClickListener(this);
    updateTime();
    setContentView(btn);
    }
This works fine in my emulator. However when i try do with an XML based layout, my app crashes in the emulator.
Main.XML contents
<?xml version="1.0" encoding="utf-8"?>
<Button xmlns:android="com.testing"
    android:id="@+id/button"
    android:text=""
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />
Code:
public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        btn=(Button)findViewById(R.id.button);
        btn.setOnClickListener(this);
        updateTime();
    }   
Does anyone know why this simple application is crashing because of the XML layout? Thanx a lot in advance :)