Android Clipboard Get getContent(Context context)

Here you can find the source of getContent(Context context)

Description

get Content

License

Open Source License

Declaration

public static String getContent(Context context) 

Method Source Code

//package com.java2s;
import android.content.Context;
import android.text.ClipboardManager;
import android.text.TextUtils;

public class Main {

    public static String getContent(Context context) {
        if (context == null) {
            return "";
        }//from  w  w w. j a v  a  2 s.  c  om
        ClipboardManager cbm = (ClipboardManager) context
                .getSystemService(Context.CLIPBOARD_SERVICE);
        String text = "";
        if (cbm != null && !TextUtils.isEmpty(cbm.getText())) {
            text = cbm.getText().toString().trim();
        }
        return text;
    }
}

Related

  1. getText(final Context context)