Note that there are some explanatory texts on larger screens.

plurals
  1. POapp crashes after recording
    text
    copied!<pre><code>mRecorder.prepare(); mRecorder.start(); Thread auto_stop=new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(30000); if(WavAudioRecorder.flag) { mRecorder.stop(); mRecorder.reset(); btnControl.setText("Start"); return ; } } catch (InterruptedException e) { //e.printStackTrace(); } } }); auto_stop.start(); </code></pre> <p>I am trying to make a recorder app which records for 30 secs and gets stopped.I am using the above mentioned code for stopping the recorder.The app crashes after recording for 30 seconds.How can the crashing part be resolved? The code which i am using for starting and stoppin is in this <a href="https://github.com/roman10/roman10-android-tutorial/tree/master/AndroidWaveRecorder" rel="nofollow">link</a>. Is there any other way to stop the recorder automatically after 30 secs</p> <pre><code>04-23 09:53:34.955: E/AndroidRuntime(4278): android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. 04-23 09:53:34.955: E/AndroidRuntime(4278): at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:4746) 04-23 09:53:34.955: E/AndroidRuntime(4278): at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:823) 04-23 09:53:34.955: E/AndroidRuntime(4278): at android.view.View.requestLayout(View.java:15468) 04-23 09:53:34.955: E/AndroidRuntime(4278): at android.view.View.requestLayout(View.java:15468) 04-23 09:53:34.955: E/AndroidRuntime(4278): at android.view.View.requestLayout(View.java:15468) 04-23 09:53:34.955: E/AndroidRuntime(4278): at android.view.View.requestLayout(View.java:15468) 04-23 09:53:34.955: E/AndroidRuntime(4278): at android.view.View.requestLayout(View.java:15468) 04-23 09:53:34.955: E/AndroidRuntime(4278): at android.widget.TextView.checkForRelayout(TextView.java:6313) 04-23 09:53:34.955: E/AndroidRuntime(4278): at android.widget.TextView.setText(TextView.java:3567) 04-23 09:53:34.955: E/AndroidRuntime(4278): at android.widget.TextView.setText(TextView.java:3425) 04-23 09:53:34.955: E/AndroidRuntime(4278): at android.widget.TextView.setText(TextView.java:3400) 04-23 09:53:34.955: E/AndroidRuntime(4278): at com.example.androidwaverecorder.MainActivity$1$1.run(MainActivity.java:53) 04-23 09:53:34.955: E/AndroidRuntime(4278): at java.lang.Thread.run(Thread.java:856) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload