Displaying a double (frequency) that is updated constantly while recording with Android

前端 未结 3 699
春和景丽
春和景丽 2021-01-03 13:36

I am building an android application that displays the Frequency of a sustained note with the FFT algorithm. I am using Jtransform methods. My issue currently is that I can\

相关标签:
3条回答
  • 2021-01-03 13:59

    SetContentView in onProgressUpdate is an error. You really do not want to change layout xml

    0 讨论(0)
  • 2021-01-03 14:02

    In addition to what Alexei said, in his answer, I think you have also incorrectly coded the method signature of onProgressUpdate():

    protected void onProgressUpdate(Double value){
    

    This means that your version of onProgressUpdate() is actually not overriding anything from AsyncTask, and will never be called.

    So, including the point about not calling setContentView() repeatedly, your final method should look like this:

    protected void onProgressUpdate(Double... frequencies){
        //print the frequency 
        String info = Double.toString(frequencies[0]);
        tv.setText(info);
    }
    
    0 讨论(0)
  • 2021-01-03 14:07

    Try replace

    protected void onProgressUpdate(Double value){
    
            //print the frequency 
            setContentView(R.layout.tuning);
            String info = Double.toString(value);
    

    with

    protected void onProgressUpdate(Double... value){
    
            //print the frequency             
            String info = Double.toString(value[0]);
    

    For others not having jtransforms.jar, refer to http://sourceforge.net/projects/jtransforms/

    0 讨论(0)
提交回复
热议问题