/** {@inheritDoc} */ @Override public void onCreate(final Bundle icicle) { super.onCreate(icicle); // Keep screen on during collecting data getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.recording); // add stop button on the screen ((Button) findViewById(R.id.stop)).setOnClickListener(this); ; sensors = (SensorManager) getSystemService(Context.SENSOR_SERVICE); handler.removeCallbacks(task); handler.postDelayed(task, 500); }