Problem with thread implementation
<p>I have a Start button to start my function for downloading data(<strong>startdownload()).</strong>
When the start button click i have placed a text view that shows data is dowmload started and when download completed the same text view show download completed .
Download function is placed under a thread.</p>

<pre><code>start_button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {                       

                Status.setText("Download Started");

                Thread t = new Thread(){      
                    public void run() {                  
                        startdownload();                                                   
                        runOnUiThread(new Runnable() {                                              
                            public void run() {                                 
                                Status.setText("Download Completed");
                                }                
                            });             
                        }};           
                        t.start(); 
            }
        });
</code></pre>

<p>Also i have a stop button to stop  downloading data,which stop the thread and shows download stopped using the same text view as above mentioned.the stop button code is as below</p>

<pre><code>stop_button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {           
                onStop();
                Status.setText("Download Stopped");             

            }

public void onStop() {
        super.onStop();
        isRunning = false;  
        }
</code></pre>

<p>The problem is that when i click start button the text view shows download started but when clicked stop button before completely dowloading the data it shows download stopped
in the text view first and after some time it shows download completed.....</p>

<p>Please any one verify that is there any problem with my thread implementation procedure...
I think thats why it shows download completed even when i stoped the thread using stop button....Please help me......</p>
