Code example for SynchronousQueue

Methods: put

0
 
    public void run() { 
        setName(LOOPER_NAME);
        Looper.prepare();
        try { 
            mHandlerQueue.put(new Handler());
        } catch (InterruptedException ie) {}
 
        Looper.loop();
    } 
 
    // Get a Handler for a looper thread, or create one if it doesn't yet exist. 
    public static synchronized Handler getHandler() {
        if (sHandler == null) {
          GeckoBackgroundThread lt = new GeckoBackgroundThread();
          lt.start();
          try { 
              sHandler = lt.mHandlerQueue.take();
          } catch (InterruptedException ie) {}
        } 
        return sHandler;