Spinner in Action Bar returns Null Pointer Exception

view story

http://stackoverflow.com – I am trying to implement a spinner in my action bar, to switch between two different fragments in the activity. To implement it, I have added the spinner using XML in my layout, and then am trying to set its adapter in the base activity class. Here's my activity class, protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); Log.i(debug,"OnCreate"); setContentView(R.layout.add_new_course); Intent intent = getIntent(); semesterID = intent.getIntExtra("Semester ID", 0); Log.i(TAG,"Add New Course created"); (HowTos)