title: How to get rid of the class/method is never used android studio
body: <p>I am running a code were it detects the highest sound made in the room. I have written my code (with some help), but warnings keep popping up saying that the class and methods aren't used. Please help.</p>
  
  <pre><code>public class SoundMeter {
  
      private MediaRecorder soundCapture = null;
  
      public void start() throws IOException {
          if (soundCapture == null) {
              soundCapture = new MediaRecorder();
              soundCapture.setAudioSource(MediaRecorder.AudioSource.MIC);
              soundCapture.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
              soundCapture.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
              soundCapture.setOutputFile("/dev/null");
              soundCapture.prepare();
              soundCapture.start();
  
          }
      }
  
      public void stop() {
          if (soundCapture != null) {
              soundCapture.stop();
              soundCapture.release();
              soundCapture = null;
          }
      }
  
      public double getAmplitude() {
          if (soundCapture != null){
              return soundCapture.getMaxAmplitude();
          }
          else{
              return 0;
          }
  
      }
  }
  </code></pre>