package net.panayiotisgeorgiou.activities;
 
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
 
public class ProfileActivity extends AppCompatActivity {
 
    private Button mBtGoBack;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_profile);
 
        mBtGoBack = (Button) findViewById(R.id.bt_go_back);
 
        mBtGoBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
 
                finish();
            }
        });
    }
}

Create ProfileActivity.java