I think the problem is that you should be using a service instead of a
background thread as you will be able to control it better.The thread will
probably become disconnected from the UI when you resume the activity.

With a service you should be able to pause/stop it when the user clicks back
and then resume it when they reenter the UI.

http://code.google.com/android/intro/lifecycle.html

On Tue, Dec 30, 2008 at 8:54 AM, Dan <danscott0...@gmail.com> wrote:

>
> Hi All,
>
> I have a basic application running under the 1.0 SDK of Android. My
> application just opens an activity that has a textview onscreen and
> then has a background thread listening for any incoming messages on a
> specific IP address and port. The app works great the first time into
> the activity. The messages are received on the background thread and
> posted to the UI thread and from there it is written to the textview
> via an append() call.
>
> The issue I'm having is when I exit the activity - via the back button
> on the G1 and then reenter the activity. When running under the
> debugger, I can still see the messages being received but when I try
> to write the message to the textview nothing happens. No text is
> written out to the control. Has anyone seen this behavior?
>
> I make sure to get a valid instance to the textview in the onCreate()
> method and I can see the code getting executed on the first entry as
> well as all subsequent entries to the activity. I have even tried
> moving my code to get the instance of the control within my message
> handler method and still nothing.
>
> I'm just wondering if there is anything that I am missing (like
> resetting the textview somehow) when I resume execution of the
> activity?
>
> Any help is greatly appreciated,
> Dan
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to