How to remove deafult action bar and add toolbar instead in android?
<p>I am developing an app in which I have window default action bar but I want to remove that and want to add toolbar instead. How can I add that</p>

<p>Code for removing action bar:</p>

<pre><code> &lt;activity
        android:name=".CMainActivity"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar"
       /&gt;
</code></pre>

<p>I am extending AppCompatActivity</p>

<pre><code>// navigation bar code
    m_Drawer = (DrawerLayout) findViewById(R.id.drawer_layout);//finding id of drawerlayout
    s_drawerToggle = new ActionBarDrawerToggle(
            this, m_Drawer, m_Toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    m_Drawer.setDrawerListener(s_drawerToggle);
    m_Drawer.setScrimColor(getResources().getColor(android.R.color.transparent));
    s_drawerToggle.syncState();

&lt;android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start"&gt;

&lt;LinearLayout
    android:id="@+id/container_toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"&gt;

    &lt;android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"

        android:titleTextColor="#FFFF"
        app:layout_scrollFlags="scroll|enterAlways"
        tools:ignore="UnusedAttribute"&gt;
    &lt;/android.support.v7.widget.Toolbar&gt;

    &lt;android.support.design.widget.TabLayout
        android:id="@+id/tab_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/primary"
        android:minHeight="?attr/actionBarSize"
        app:tabIndicatorColor="@android:color/white"
        app:tabIndicatorHeight="2dp"
        app:tabTextAppearance="?android:textAppearanceMedium"
        tools:ignore="UnusedAttribute"/&gt;

    &lt;android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/&gt;

&lt;/LinearLayout&gt;

&lt;android.support.design.widget.NavigationView
    android:id="@+id/nav_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:fitsSystemWindows="true"
    app:headerLayout="@layout/nav_header_main"
    app:menu="@menu/activity_main_drawer"
    tools:ignore="PrivateResource"/&gt;
</code></pre>

<p></p>