get Item Count from Clipboard for HONEYCOMB - Android android.content

Android examples for android.content:Clipboard

Description

get Item Count from Clipboard for HONEYCOMB

Demo Code

import android.annotation.TargetApi;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.os.Build;
import android.text.TextUtils;

public class Main{

    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    public static int getItemCount(Context context) {
        ClipboardManager clipboard = (ClipboardManager) context
                .getSystemService(Context.CLIPBOARD_SERVICE);
        ClipData data = clipboard.getPrimaryClip();
        return data.getItemCount();
    }//from  w  w w.ja v a2  s  . c  o  m

}

Related Tutorials