I have a base class that checks if app is launched from history, and no processes of app are available, then redirect user to MainActivity. 
This is my base class code;
    public abstract class BaseActivity extends AppCompatActivity {
    protected void onCreate(Bundle savedInstanceState) {
       if(MainActivity.instance == null){
       //instance is a static variable in MainActivity
             Intent i= new Intent(this, MainActivity.class);
             startActivity(i);
             this.finish();
             return;   
       }else{
           setContentView(getLayoutRes());
       }
    }   
   //Child app override this method, and provides their layout.
   protected abstract int getLayoutRes();
Child Activity
public class MapActivity extends BaseActivity{
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //1000 line of code 
}   
@Override
protected int getLayoutRes() {
    return R.layout.activity_map;
}
Now what it does when user launches the app from history, and no processes of the app are available, then it reads the check of BaseActivity and tries to start the MainActivity intent, and does not set the layout, 
but the problem is that it does not stop there, it goes to MapActivity - onCreate() method and start executing the other lines of code, as i have not set layout, it crashes while trying to read findViewById(), it also fails at other static variables. 
So the whole point of redirecting user to MainActivity when the process is killed is not fullfiled. 
I need to know how to stop executing code of child class when BaseClass start the intent