People,
Here is the simplified code for my background thread:
public class MyThread extends Thread { private Handler _handler; public void run() { Looper.prepare(); this._handler = new Handler(); Looper.loop(); } public void DoSomething() { if (!this.isAlive()) { this.start(); } this._handler.post(blah); } }
The problem is that the background thread may not have created a handler object yet when calling post (). Essentially, I need a wait loop to initialize the handler object. What generates the accepted method of this in Android?
Thank you in advance for your help.
Regards, Peter
source share