Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.ClipboardManager; import android.content.Context; import android.os.Build; public class Main { private static ClipboardManager mClipboardManager; private static android.content.ClipboardManager mNewCliboardManager; private static void instance(Context context) { if (isNew()) { if (mNewCliboardManager == null) mNewCliboardManager = (android.content.ClipboardManager) context .getSystemService(Context.CLIPBOARD_SERVICE); } else { if (mClipboardManager == null) mClipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); } } private static boolean isNew() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB; } }