@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_soundrecorder); recordLayout = (LinearLayout) findViewById(R.id.recordLayout); recordButton = (ImageView) findViewById(R.id.recordButton); recordText = (TextView) findViewById(R.id.recordText); recordingIndicationText = (TextView) findViewById(R.id.recording); recordLayout.setOnClickListener(this); soundRecorder = (SoundRecorder) getLastCustomNonConfigurationInstance(); if (soundRecorder != null && soundRecorder.isRecording()) { setViewsToRecordingState(); } Utils.checkForSdCard(this); }