Can anyone help me to find out what can be the issue with this program.
In the onCreate() method the findViewById() returns null for all ids and th
findViewById() returns a View if it exists in the layout you provided in setContentView(), otherwise it returns null and that's what happening to you.
Example if you setContentView(R.layout.activity_first); and then call findViewById(R.id.first_View); it will return a View which is your layout.
But if you call findViewById(R.id.second_View); it will return null since there is not a view in your activity_first.xml layout called @+id/second_View.