Code example for ClipData

Methods: getItemAt

0
        @Override 
        public void onPrimaryClipChanged() { 
            Log.d(TAG, "onPrimaryClipChanged"); 
            ClipData clip = mClipboardManager.getPrimaryClip(); 
            mThreadPool.execute(new WriteHistoryRunnable( 
                    clip.getItemAt(0).getText())); 
        } 
    }; 
 
    private class WriteHistoryRunnable implements Runnable {
        private final Date mNow;
        private final CharSequence mTextToWrite;
 
        public WriteHistoryRunnable(CharSequence text) {
            mNow = new Date(System.currentTimeMillis());
            mTextToWrite = text;
        } 
 
        @Override 
        public void run() { 
            if (TextUtils.isEmpty(mTextToWrite)) {