[android-developers] Re: How to do a Thread that only executes itself one time? (but continues alive)

2011-09-27 Thread Ryan Mattison
I think saex is looking for a producer / consumer model using a LinkedBlockingQueue with Weak references, so he can read the settings into a queue when they're available, but his application may not need them until slightly later, and needs to aggregate the results. Weak reference would allow

[android-developers] Re: How to do a Thread that only executes itself one time? (but continues alive)

2011-09-27 Thread Ryan Mattison
:P :P :P On Sep 26, 8:03 am, saex elpablos...@gmail.com wrote: Hi i need to put some listeners on a Thread (to optimize my app), then, the Thread should be executed one time, but it needs to continue alive, because the listeners have to be alive to listen for events. I tryed with this

[android-developers] Re: How to do a Thread that only executes itself one time? (but continues alive)

2011-09-26 Thread saex
But i want to do it on a separate Thread, to optimize my app removing tasks from the main thread, because the main thread have a lot of tasks on it and it needs to use threads for such thinks please tell me how to make a thread that only executes itself one time On 26 sep, 15:20, TreKing

Re: [android-developers] Re: How to do a Thread that only executes itself one time? (but continues alive)

2011-09-26 Thread TreKing
On Mon, Sep 26, 2011 at 8:37 AM, saex elpablos...@gmail.com wrote: But i want to do it on a separate Thread, to optimize my app removing tasks from the main thread, because the main thread have a lot of tasks on it and it needs to use threads for such thinks Putting arbitrary functionality

[android-developers] Re: How to do a Thread that only executes itself one time? (but continues alive)

2011-09-26 Thread saex
It is for Augmented Reality App, i really need to use Threads for this, or the camera doesn't works properly The code that i posted gives me an exception how can i avoid that exception? the Exception is posted in the question. Thanks On 26 sep, 16:52, TreKing treking...@gmail.com wrote: On

Re: [android-developers] Re: How to do a Thread that only executes itself one time? (but continues alive)

2011-09-26 Thread Kostya Vasilyev
The exception is due to your thread not having a Looper, which a fundamental low-level mechanism used by Android to delivers events to an application. You can fix this, but You don't really need a thread for this - after you register a listener, the main thread will continue to run,

Re: [android-developers] Re: How to do a Thread that only executes itself one time? (but continues alive)

2011-09-26 Thread TreKing
On Mon, Sep 26, 2011 at 10:25 AM, saex elpablos...@gmail.com wrote: It is for Augmented Reality App, i really need to use Threads for this, or the camera doesn't works properly No, you really don't. If you need help with the camera, try explaining what doesn't works properly means, and why

Re: [android-developers] Re: How to do a Thread that only executes itself one time? (but continues alive)

2011-09-26 Thread Kristopher Micinski
In most reality, using bare threads in Android also seems a bit contrived, there are a few more system appropriate utilities you might look into.. Kris On Mon, Sep 26, 2011 at 11:35 AM, TreKing treking...@gmail.com wrote: On Mon, Sep 26, 2011 at 10:25 AM, saex elpablos...@gmail.com wrote: It

[android-developers] Re: How to do a Thread that only executes itself one time? (but continues alive)

2011-09-26 Thread Indicator Veritatis
Also, while you are on the topic of Threads and Loopers, 99% of the time, if you think you need to create your own Looper instead of using one created by the system, your design has a mistake in it. Handler, HandlerThread and pre-existing Loopers should be enough. Even then AsyncTask is often