Code example for LinkedBlockingQueue

Methods: put

0
    }; 
 
    public static void showToast(ReaderView anchor, String msg, int duration) {
    	mReaderView = anchor;
        try { 
            queue.put(new Toast(anchor, msg, duration));
        } catch (InterruptedException e) {
            e.printStackTrace();
        } 
        if (showing.compareAndSet(false, true)) {
            show(); 
        } 
    } 
 
    private static void show() { 
        if (queue.size() == 0) {
            showing.compareAndSet(true, false);
            return; 
        } 
        Toast t = queue.poll();
        window = new PopupWindow(t.anchor.getContext());