My service running even if i close my app, and couldn't write it to my layout
<p>i wrote an application that listens received sms'.<br>
2 problems occured. First , I noticed that my service is running even if i close my app.
And second is that i couldn't make it write to my sms.xml layout. It shows the Toast but not writing to the screen.</p>

<p>This is my activity. </p>

<pre><code>import android.app.Activity;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.IBinder;
import android.telephony.SmsMessage;
import android.util.Log;
import android.widget.TextView;
import android.widget.Toast;

public class SMSGoster extends Activity {

    public TextView t;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sms);
        t=(TextView) findViewById(R.id.smsText);
        t.setText("Okumaya Baslandı!\n");
    }

    public class SMSService extends Service {

        private SMSreceiver mSMSreceiver;
        private IntentFilter mIntentFilter;
        public TextView t;

        @Override
        public void onCreate() {
            super.onCreate();
            // SMS event receiver
            mSMSreceiver = new SMSreceiver();
            mIntentFilter = new IntentFilter();
            mIntentFilter.addAction("android.provider.Telephony.SMS_RECEIVED");
            registerReceiver(mSMSreceiver, mIntentFilter);
            t=(TextView) findViewById(R.id.smsText);
        }

        @Override
        public void onDestroy() {
            super.onDestroy();

            // Unregister the SMS receiver
            unregisterReceiver(mSMSreceiver);
        }

        @Override
        public IBinder onBind(Intent arg0) {
            // TODO Auto-generated method stub
            return null;
        }



    }

    private class SMSreceiver extends BroadcastReceiver {
        private final String TAG = this.getClass().getSimpleName();
        public TextView t;
        @Override
        public void onReceive(Context context, Intent intent) {
            Bundle extras = intent.getExtras();

            String strMessage = "";

            if (extras != null) {
                Object[] smsextras = (Object[]) extras.get("pdus");

                for (int i = 0; i &lt; smsextras.length; i++) {
                    SmsMessage smsmsg = SmsMessage
                            .createFromPdu((byte[]) smsextras[i]);

                    String strMsgBody = smsmsg.getMessageBody().toString();
                    String strMsgSrc = smsmsg.getOriginatingAddress();

                    strMessage += "SMS from " + strMsgSrc + " : " + strMsgBody;

                    Log.i(TAG, strMessage);
                    smsReceived(strMessage);
                    Toast.makeText(getApplicationContext(), strMessage,
                            Toast.LENGTH_LONG).show();
                }

            }

        }
        public void smsReceived(String s) {
            t=(TextView) findViewById(R.id.smsText);
            t.append(s);
        }
    }

}
</code></pre>

<p>This is the layout : sms.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" &gt;

    &lt;TextView
        android:id="@+id/smsText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>And this is the manifes file :</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.emre"
    android:versionCode="1"
    android:versionName="1.0" &gt;

    &lt;uses-sdk android:minSdkVersion="10" /&gt;
    &lt;uses-permission android:name="android.permission.RECEIVE_SMS" /&gt;
    &lt;uses-permission android:name="android.permission.SEND_SMS" /&gt;
    &lt;application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" &gt;
     &lt;activity
            android:name="SMSGoster"
            android:label="@string/app_name" &gt;
            &lt;service
                android:name="SMSService"
                android:enabled="true" &gt;
                &lt;intent-filter&gt;
                    &lt;action android:name="SMSService" /&gt;
                &lt;/intent-filter&gt;
            &lt;/service&gt;
        &lt;/activity&gt;
    &lt;/application&gt;
&lt;/manifest&gt;
</code></pre>

<p>Any advice would be great!
Best Regards.</p>
