How to setSupportActionBar in a view that extends LifecycleActivity : <p>I had an Activity that extended AppCompactActivity, and in <code>onCreate</code> method I setted the <code>Toolbar</code> using <code>setSupportActionBar</code> method in the usual way:</p>

<pre><code>public class StepMasterActivity extends AppCompatActivity{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_step_master);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);`
    }
}
</code></pre>

<p>But now I have a <a href="https://developer.android.com/topic/libraries/architecture/viewmodel.html#the_lifecycle_of_a_viewmodel" rel="noreferrer">ViewModel</a> component and to share data between fragments that are the children of this activity and manages lifecycles I have to get this component in Activity and so I make this extend LifecycleActivity. </p>

<pre><code>public class StepMasterActivity extends LifecycleActivity {

    @Override
    public class StepMasterActivity extends LifecycleActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_step_master);
        // setToolbar();
        SharedViewModel sharedViewModel = ViewModelProviders.of(this).get(SharedViewModel.class);
    }
}
</code></pre>

<p>But I noticed that LifecycleActivity has nothing to do with AppCompatActivity neither FragmentActivity does.</p>

<pre><code>public class LifecycleActivity extends FragmentActivity implements LifecycleRegistryOwner {
    private final LifecycleRegistry mRegistry = new LifecycleRegistry(this);

    public LifecycleActivity() {
    }

    public LifecycleRegistry getLifecycle() {
        return this.mRegistry;
    }
}
</code></pre>

<p>Am I doing something wrong? </p>
