Could not kill the current process in android
<p>I have an application in which I need to kill the application after it asks some confirmation from the user. I am using the following code snippet.</p>

<pre><code>    while(tts.isSpeaking());

tts.speak("Quitting application",TextToSpeech.QUEUE_FLUSH, null);

    while(tts.isSpeaking());
    tts.shutdown();
    int pid = android.os.Process.myPid();
    android.os.Process.killProcess(pid);
</code></pre>

<p>The tts engine is saying "quitting application". And screen goes blank for some time. Then after that the application is restarting. I am not getting where I am going wrong.</p>

<p>I have tried the <code>System.exit(0)</code> as well. Still same thing happening. Show me the right way. I also have some problems with using tts. I can't synchronize the speaking and many events during application run. How can I overcome this problem?</p>
