Code example for DecimalFormat

Methods: setMaximumFractionDigits, setMinimumFractionDigits, setRoundingMode

0
		// Wait for one second until gyroscope and magnetometer/accelerometer 
		// Data is initialized then schedule the complementary filter task 
		fuseTimer.scheduleAtFixedRate(new calculateFusedOrientationTask(),1000, TIME_CONSTANT);
 
		// GUI stuff 
		d.setRoundingMode(RoundingMode.HALF_UP);
		d.setMaximumFractionDigits(3);
		d.setMinimumFractionDigits(3);
	} 
 
	// This function registers sensor listeners for the accelerometer, magnetometer and gyroscope. 
	public void initListeners() { 
		if (mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER) != null)
			mSensorManager.registerListener(this,mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),SensorManager.SENSOR_DELAY_FASTEST);
		else { 
			if (D)
				Log.i(TAG, "Accelerometer not supported");
		} 
		if (mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE) != null) {
			mSensorManager.registerListener(this,mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE),SensorManager.SENSOR_DELAY_FASTEST);
			IMUOutputSelection = 2;