Code example for SynchronousQueue

Methods: put

0
 
    @Override 
    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. 
    /*package*/ static synchronized Handler getHandler() {
        if (sHandler == null) {
            GeckoBackgroundThread lt = new GeckoBackgroundThread();
            ThreadUtils.setBackgroundThread(lt);
            lt.start();
            try { 
                sHandler = lt.mHandlerQueue.take();
            } catch (InterruptedException ie) {}