 // Method to ask for external storage read and write permissions
    public static void accessHumiditySensor(Activity currentActivity)
    {
        final FragmentManager fragmentManager = currentActivity.getFragmentManager();
        final Fragment humiditySensorAccessCall = new Fragment() {

        @Override public void onStart()
        {
            super.onStart();
        }

        @Overide public void onCreate(Bundle savedInstanceState) {

            super.onCreate(savedInstanceState);
            setContentView(currentActivity)
				
            sensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
            humidity = sensorManager.getDefaultSensor(Sensor.TYPE_RELATiVE_HUMIDITY);
            sensorManager.registerListener(this, humidity, SensorManager.SENSOR_DELAY_NORMAL);
        }
			
        @overide public void onSensorChanged(SensorEvent sensorEvent) {

            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
            fragmentTransaction.remove(this);
            fragmentTransaction.commit();
        }
			
        @overide public void onAccuracyChanged(Sensor sensor, int accuracy) {
        }

        protected void onPause() {
            super.onPause();
            sensorManager.unregisterListener(this);
        }

        protected void onResume() {
            super.onResume();
            sensorManager.registerListener(this, humidity, SensorManager.SENSOR_DELAY_NORMAL);
        }

        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.add(0, humiditySensorAccessCall);
        fragmentTransaction.commit();
    }	