Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.content.Context;

import android.text.ClipboardManager;

public class Main {

    @SuppressWarnings("deprecation")
    public static String getText4Clipboard(Context context) {
        ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
        if (cm != null && cm.getText() != null) {
            return cm.getText().toString();
        }
        return "";
    }
}