Displaying Another Screen Onclick in Android
<pre><code>package com.example.example;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.widget.Button;
import android.view.View;
import android.view.View.OnClickListener;

public class MainActivity extends Activity {
    Button btn;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        this.setContentView(R.layout.activity_main);
        this.btn = (Button)this.findViewById(R.id.button);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        this.btn.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {         
                Intent intent = new Intent(MainActivity.this, profile.class);
                startActivity(intent);
            }     
        });
    }
}
</code></pre>

<p>I don't get any errors however my program also dont run as I want. I am new in android and I want to change the screen after the button is clicked for that I am using two classes so in one class my program should invoke another one onclick. How can I do this ? My code is as above.</p>
