time = 15; } bPlaySound = playSound.isChecked(); if ((((SystemClock.elapsedRealtime() - chronometer.getBase())/1000)/60) >= time) { cChronometer.stop(); cChronometer.setText("00:00"); if (bPlaySound) { AudioManager audioManager = (AudioManager) getActivity().getSystemService(getActivity().AUDIO_SERVICE); float actualVolume = (float) audioManager .getStreamVolume(AudioManager.STREAM_MUSIC); float maxVolume = (float) audioManager .getStreamMaxVolume(AudioManager.STREAM_MUSIC); volume = actualVolume / maxVolume; if (loaded) { soundPool.play(soundID, volume, volume, 1, 0, 1f); } } cChronometer.setBase(SystemClock.elapsedRealtime()); cChronometer.start(); } } }); ((Button) getView().findViewById(R.id.pause_button)).setOnClickListener(new OnClickListener() {