package br.com.sailboat.canoe.base;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;

import br.com.sailboat.canoe.R;

public abstract class BaseActivitySingleFragment<T extends Fragment> extends AppCompatActivity {

    private static final String TAG_BASE_FRAGMENT = "TAG_BASE_FRAGMENT";
    private T fragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.frame_layout);
        initViews();
        checkStateAndAddFragment();
    }

    protected void initViews() {}

    private void checkStateAndAddFragment() {
        fragment = (T) getSupportFragmentManager().findFragmentByTag(TAG_BASE_FRAGMENT);

        if (fragment == null) {
            fragment = newFragmentInstance();
            addFragment();
        }
    }

    private void addFragment() {
        getSupportFragmentManager()
                .beginTransaction()
                .add(R.id.frameLayout, fragment, TAG_BASE_FRAGMENT)
                .commit();
    }

    protected abstract T newFragmentInstance();

}
@@ -56,16 +56,61 @@
 Bundle;%0A
+import android.support.annotation.LayoutRes;%0A
 import a
@@ -562,29 +562,21 @@
 iew(
-R.layout.frame_l
+getL
 ayout
+Id()
 );%0A 
@@ -630,32 +630,126 @@
 gment();%0A    %7D%0A%0A
+    @LayoutRes%0A    protected int getLayoutId() %7B%0A        return R.layout.frame_layout;%0A    %7D%0A%0A
     protected vo

Add getLayoutId method in BaseActivitySingleFragment