title: On switching activity I am lossing activity bar
body: <p>When I am switching from one activity to another I am losing my activity bar in which it should show title of activity.</p>
  
  <p><a href="https://i.stack.imgur.com/uZLib.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uZLib.png" alt="enter image description here"></a></p>
  
  <p>On clicking on a particular list view I get following screen.</p>
  
  <p><a href="https://i.stack.imgur.com/JLcae.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JLcae.png" alt="enter image description here"></a></p>
  
  <p>Code for DetailAcivity[ Second screenshot ] :</p>
  
  <pre><code>public class DetailActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_detail);
          if(savedInstanceState == null ){
              getSupportFragmentManager().beginTransaction()
                      .add(R.id.detail_container, new DetailFragment())
                      .commit();
  
          }
      }
  
      public static class DetailFragment extends Fragment{
          @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                   Bundle savedInstanceState) {
              View rootView = inflater.inflate(R.layout.fragment_detail, container, false);
  
              Intent intent = getActivity().getIntent();
              String forcastString = intent.getStringExtra(Intent.EXTRA_TEXT);
              ((TextView)rootView.findViewById(R.id.detail_text)).setText(forcastString);
  
              return rootView;
          }
      }
  } 
  </code></pre>
  
  <p>Layouts of detail activities are as follow :</p>
  
  <p>activity_detail.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
      android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:id="@+id/detail_container"
      tools:context="com.example.android.sunshine.DetailActivity"&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>fragment_detail.xml</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".MainActivity$PlaceholderFragment"&gt;
  
      &lt;TextView
          android:id="@+id/detail_text"
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
      &lt;/TextView&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>So can anyone help why my title bar is missing?</p>