Implement getMaxAmplitude for audioRecord
<p>I am using audioRecord instead of mediarecorder in my app it's working fine but I have a logic that depends highly on the maxamplitude which is really hard to obtain using the audiorecord here is what I am using when reading the buffer </p>

<pre><code> private void writeAudioDataToFile(){
        byte data[] = new byte[bufferSize];

        String filename = getTempFilename();
        FileOutputStream os = null;

        try {
            os = new FileOutputStream(filename);
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        int read = 0;
        max=0;
        if(null != os){
            while(isRecording){
                read = recorder.read(buffer, 0, bufferSize);
                int amplitude = (buffer[0] &amp; 0xff) &lt;&lt; 8 | buffer[1];
                amplitude = Math.abs(ab);

            if(amplitude&gt;0&amp;&amp;amplitude&lt;25000)
                isSilence=true;         
            else
                isSilence=false;

                //System.out.println("&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;"+amplitude);
                if(AudioRecord.ERROR_INVALID_OPERATION != read){
                    try {
                        os.write(buffer);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }

            try {
                os.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
</code></pre>

<p>but this doesn't work for me as the value changes real fast I need to implement something like getMaxAmplitude() for audioRecord.</p>
