If above is your full code then, basic problem is there, you haven't define btn
. You need to define it before using it, else when you ar egoing to click on the button it will not work. and this might closing your application.
btn=(Button) findViewById(R.id.button1);