Add a runnable thread inside an Async Task for splash screen delay
<p>Hi I wanted to add a delay on my splash screen using a Async Task but I can't figure out how should I do it. Here's my DoInBackground code so far:</p>

<pre><code>@Override
        protected Integer doInBackground(String... params) {

            Thread SplashThread = new Thread() {
                    @Override
                    public void run() {
                        try {
                            int waited = 0;
                            while(running &amp;&amp; (waited &lt; delayTime)) {
                                sleep(100);
                                if(running) {
                                    waited += 100;
                                }
                            }
                        } catch(InterruptedException e) {
                            // do nothing
                        } finally {
                            finish();
                            stop();
                        }
                    }
                };
                SplashThread.start();

            return null;
        }
</code></pre>

<p>I think the part of the return null is the main cause of problem since it's ending up my Async Task even my SplashThread is still running in background leaving a leak on thins part onwards which lead to error. I also tried to use counDownTimer as a subtitute but this leads in the same problem. Any ways to do this properly?</p>
