Get text from clipboard - Android android.content

Android examples for android.content:Clipboard

Description

Get text from clipboard

Demo Code

import android.content.ClipboardManager;
import android.content.Context;

public class Main{


    public static String paste(Context context) {
        ClipboardManager cmb = (ClipboardManager) context
                .getSystemService(Context.CLIPBOARD_SERVICE);
        return cmb.getText().toString().trim();
    }//  w w w.  j  a  v a  2  s  .c  om

}

Related Tutorials