Code example for SynchronousQueue

0
import java.util.concurrent.SynchronousQueue; 
 
public final class Clipboard { 
    private static Context mContext;
    private final static String LOG_TAG = "Clipboard";
    private final static SynchronousQueue<String> sClipboardQueue = new SynchronousQueue<String>();
 
    private Clipboard() { 
    } 
 
    public static void init(Context c) {
        if (mContext != null) {
            Log.w(LOG_TAG, "Clipboard.init() called twice!");
            return; 
        } 
        mContext = c;
    } 
 
    @GeneratableAndroidBridgeTarget(stubName = "GetClipboardTextWrapper") 
    public static String getText() {
        // If we're on the UI thread or the background thread, we have a looper on the thread