in my android app. I have a ui update thread that keeps all my views up to date.
protected Thread UIUpdateThread = new Thread()
{
@Override
public void run()
{
while(true)
{
query_some_data_from_service();
UIUpdateHandler.sendEmptyMessage(0);
sleep(1234);
}
}
};
Run this thread in onCreate () with
UIUpdateThread.start();
and everything works just fine :) when I leave the action (for example, because I switch to another action), I call
UIUpdateThread.interrupt();
inside onStop () to prevent the stream from running continuously. if I do not, it will work even if I close the application!?!? !!
Problemconsists in the following: how can I return this stream to life, returning from some other activity to this? run () does not work, calling initial start () in some other method, for example onResume (), the application crashes.
I already tried a lot, but nothing works :(