android Thread and Service
<p>I am using below code.</p>

<pre><code>   import android.app.Activity;
import android.os.Bundle;
import android.provider.ContactsContract.Data;
import android.util.Log;

public class ActivityDemoActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        new Thread(new Runnable() {

            @Override
            public void run() {
                int i=0;
                while(true){
                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    Log.i("DATA", "Data.CONTENT_TYPE......"+(i++));
                }

            }
        }).start();
    }
    @Override
    public void onBackPressed(){
        finish();
    }
}
</code></pre>

<p>When I press Back button of device still thread is working in background.</p>

<p>My questions are...</p>

<ol>
<li>when thread will stop?</li>
<li>Then why we required services in android?</li>
</ol>

<p>Thank You.</p>
