/** registerListener of SensorManager if not have sensor,no register the listener */ @Override public void onResume() { if (hasGSsor) { mSsorManager.registerListener(this, gssor, SensorManager.SENSOR_DELAY_NORMAL); } super.onResume(); }
@Override public void onResume() { // TODO Auto-generated method stub super.onResume(); mivPicture.setBackgroundResource(R.drawable.lcd_test_00); mImageNum = 8; // chb add // mView.setOnTouchListener(this); mivPicture.setOnClickListener(this); }
/** when leave this Activity, unregisterListener of SensorManager */ @Override public void onPause() { mSsorManager.unregisterListener(this); mGSsorView.clearViewState(); super.onPause(); }