title: How to add ActionBar to Activity in Android
body: <p>I am trying to add ActionBar to my android activity, but app automatically closes due to some code error. So what is the proper code to display ActionBar in the Activity?</p>
  
  <p>I tried this code in onCreate method but its not working</p>
  
  <pre><code>ActionBar actionBar;
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.timetable);
  
     actionBar = getActionBar();
     actionBar.setTitle("MY TITLE");
     actionBar.show();
   }
  </code></pre>