Android Open Source - notify-me-android Clipboard Text View






From Project

Back to project page notify-me-android.

License

The source code is released under:

MIT License

If you think the Android project notify-me-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.contexthub.notifyme.widget;
/*www.ja v  a  2s .  c o m*/
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.contexthub.notifyme.R;

/**
 * Created by andy on 11/3/14.
 */
public class ClipboardTextView extends TextView implements View.OnClickListener {

    public ClipboardTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
        setClickable(true);
        setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        ClipboardManager clipboard = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
        ClipData clip = ClipData.newPlainText("simple text", getText());
        clipboard.setPrimaryClip(clip);
        Toast.makeText(getContext(),
                getContext().getString(R.string.copied_to_clipboard, getText()),
                Toast.LENGTH_SHORT).show();
    }
}




Java Source Code List

com.contexthub.notifyme.ApplicationTest.java
com.contexthub.notifyme.Constants.java
com.contexthub.notifyme.MainActivity.java
com.contexthub.notifyme.NotifyMeApp.java
com.contexthub.notifyme.fragments.AboutFragment.java
com.contexthub.notifyme.fragments.DeviceFragment.java
com.contexthub.notifyme.fragments.PushReceiveFragment.java
com.contexthub.notifyme.fragments.PushSendFragment.java
com.contexthub.notifyme.model.CustomData.java
com.contexthub.notifyme.model.PushNotificationHistory.java
com.contexthub.notifyme.model.ReceivedPushNotification.java
com.contexthub.notifyme.push.NotificationHandler.java
com.contexthub.notifyme.widget.ClipboardTextView.java