package com.pisces.demo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;

public class BaseActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    protected void setUpToolBar() {
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
}

@@ -135,16 +135,46 @@
 Toolbar;
+%0Aimport android.view.MenuItem;
 %0A%0Apublic
@@ -550,11 +550,382 @@
 );%0A    %7D
+%0A%0A    @Override%0A    public boolean onOptionsItemSelected(MenuItem item) %7B%0A        boolean bool = true;%0A        switch (item.getItemId()) %7B%0A            case android.R.id.home:%0A                onBackPressed();%0A                break;%0A%0A            default:%0A                bool = super.onOptionsItemSelected(item);%0A                break;%0A        %7D%0A%0A        return bool;%0A    %7D
 %0A%7D%0A

enable back to previous page by back button on toolbar.