@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_base); // compass stuff compassManager = new CompassManager(this); // register for rotation updates compassManager.registerRotationListener(this); azimuthBuffer = new ArrayList<>(); devices = (ArrayList<BluetoothDevice>) getIntent().getSerializableExtra(StartMenuActivity.EXTRA_DEVICES); measureFragment = MeasureFragment.getInstance(devices.size()); resultFragment = new ResultFragment(); // activate the measure fragment FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.main_container, measureFragment); fragmentTransaction.commit(); currentFragment = measureFragment; // as long as the app is measuring, the screen should not turn off getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); }
@Override protected void onPause() { super.onPause(); compassManager.stop(); }
@Override protected void onResume() { super.onResume(); compassManager.start(); }