Android: Updating a Textview for an activity inside a thread
<p>Working with two activities.  If I wanted to do something like checking internet connectivity and updating another activity with the result, how do I get the statusMessage to display on the 2nd activity layout in the Textview there when I'm inside a thread of the 1st activity... Right now, the text doesn't change on the 2nd activity's textview.  If I need to reference a property from the 2nd activity from the first launch one, how do I do that?</p>

<pre><code>Second Activity: 

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.view.MotionEvent;
import android.widget.TextView;


public class CopyOfSplash extends Activity {
protected boolean _active = true;
protected int _splashTime = 15000;
TextView mainText;
String statusMessage;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash);

    Thread splashTread = new Thread() {
        @Override
        public void run() {
            try {

                ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);    
                NetworkInfo netInfo = cm.getActiveNetworkInfo();    
                if (netInfo.isConnected()) 
                {
                     statusMessage= "Connected to the internet!";
                }   
                else
                {
                    statusMessage = "User is probably in airplane mode!";           
                }




            } catch(InterruptedException e) {
                // do nothing
            } finally {
                finish();
                startActivity(new Intent("com.nwp.Main")); 
               runOnUiThread(new Runnable() {
                    @Override
    public void run() {               
                        setContentView(R.layout.main);
                  mainText = (TextView) findViewById(R.id.mainTextView);
           mainText.setText(statusMessage);
            }        

             });

                stop();

            }
        }
    };

    splashTread.start();
}


@Override
public boolean onTouchEvent(MotionEvent event) {
    if (event.getAction() == MotionEvent.ACTION_DOWN) {
        _active = false;
    }
    return true;
}
}


First Activity:

public class Main extends Activity {


/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);


  }
}

Manifest File:

&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nwp" android:versionCode="1" android:versionName="1.0"&gt;
&lt;uses-sdk android:minSdkVersion="7" /&gt;
&lt;uses-permission android:name="android.permission.INTERNET"&gt;&lt;/uses-permission&gt;
&lt;application android:icon="@drawable/icon" 
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"   android:label="@string/app_name"&gt;
    &lt;activity android:name=".Splash"
              android:label="@string/app_name"   
              android:screenOrientation="landscape" 
              android:configChanges="keyboardHidden|orientation" &gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;
            &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
        &lt;/intent-filter&gt;
    &lt;/activity&gt;
    &lt;activity android:name="com.nwp.Main" 
              android:screenOrientation="landscape" 
              android:configChanges="keyboardHidden|orientation"&gt;
        &lt;intent-filter&gt;
            &lt;action android:name="com.nwp.Main" /&gt;
            &lt;category android:name="android.intent.category.DEFAULT" /&gt;
        &lt;/intent-filter&gt;
    &lt;/activity&gt;
&lt;/application&gt;
</code></pre>

<p></p>
