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\
SetContentView in onProgressUpdate is an error. You really do not want to change layout xml
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);
}
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/