how to move from one screen from another in android
<p>I am new to android. I want to develop an android app that contains multiple screens. I have already developed one app which contains 2 pages; if I click a button on the page it displays another page. Here is the code:</p>

<pre><code>protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Button button = (Button) findViewById(R.id.button1);
    button.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            setContentView(R.layout.screen2);
        }
    });
}
</code></pre>

<p>Everything is working fine, but when I am in <strong>screen2</strong>, if I press the back button it is exiting but I have to go to <strong>activity_main</strong>.</p>

<p>Do I need to add any further code to back button?</p>
