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

谁说胖子不能爱 提交于 2019-11-30 16:33:19
Nate

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);
}

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

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/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!