How to dynamically update TextView text
<p>Inside of a BroadcastReceiver I keep track of each time a list is downloaded and each time it is I want to update a textview with the last time. I have done the following but the time never gets displayed.</p>

<pre><code>@Override
public void onReceive(Context context, Intent intent) {
_context = context;
Toast.makeText(context, "ListDownloadReceiver....", Toast.LENGTH_SHORT)
    .show();

boolean force = intent.getBooleanExtra("FORCE", false);

long nextUpdateTime = getUpdateTime();

if (force || nextUpdateTime &lt; System.currentTimeMillis()) {
    if (isNetworkAvailable()) {
    Log.i(LIST_DOWNLOAD_RECEIVER,
        "Going to be downloading the list...");
    DownloadListData downloadList = new DownloadListData(context);
    downloadList.execute();

    } else {
    Log.i(LIST_DOWNLOAD_RECEIVER, "Not connected...");
    context.registerReceiver(this, new IntentFilter(
        ConnectivityManager.CONNECTIVITY_ACTION));
    }
}

DatabaseHandler db = DatabaseHandler.getInstance(context);
String timeFormat = "d/M/yyyy 'at' k:mm:ss";

long lastUpdate = Long.valueOf(db.getPreference("LAST_UPDATED_TIME",
    "0"));

CharSequence time = DateFormat.format(timeFormat, lastUpdate);
Log.i(LIST_DOWNLOAD_RECEIVER, "Time is: " + time);

LayoutInflater inflater = (LayoutInflater) context
    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.activity_main, null);
TextView tv = (TextView) view.findViewById(R.id.lastRefreshed);
tv.append("Blah: " + time);

}
</code></pre>

<p>This is my .xml file</p>

<pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="left|top"
    android:orientation="vertical" &gt;

    &lt;LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/noShowsLayout"
        android:layout_width="match_parent"
        android:layout_height="115dp"
        android:orientation="horizontal"
        android:background="@color/blue" &gt;

        &lt;TextView
            android:id="@+id/noShowsTextView"
            android:layout_width="match_parent"
            android:layout_height="fill_parent"
            android:gravity="center"
            android:text="@string/no_added_shows"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textSize="18dip" /&gt;
    &lt;/LinearLayout&gt;

    &lt;LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal" &gt;

        &lt;ListView
            android:id="@+id/listView1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" &gt;
        &lt;/ListView&gt;
    &lt;/LinearLayout&gt;

    &lt;LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="48dp"
        android:layout_gravity="bottom"
        android:background="@color/blue"
        android:orientation="horizontal" &gt;

        &lt;ImageButton 
            android:id="@+id/refreshButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="left"
            android:contentDescription="@string/refresh"
            android:src="@drawable/refresh"/&gt;

        &lt;TextView
            android:id="@+id/lastRefreshed"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:layout_gravity="center"
            android:layout_marginLeft="5dp"
            android:text="@string/lastRefreshTime" 
            android:textAppearance="?android:attr/textAppearanceSmall" /&gt;

        &lt;ImageButton
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:contentDescription="@string/remove_tv_show"
            android:src="@drawable/content_discard" 
            android:clickable="false"/&gt;


    &lt;/LinearLayout&gt;

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