use of android.content.ClipboardManager in project qksms by moezbhatti.
the class MessageUtils method copyToClipboard.
public static void copyToClipboard(Context context, String str) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setPrimaryClip(ClipData.newPlainText(null, str));
}
use of android.content.ClipboardManager in project android-common by litesuits.
the class ClipboardUtil method copyToClipboard.
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static void copyToClipboard(Context context, String text) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setPrimaryClip(ClipData.newPlainText(null, text));
}
use of android.content.ClipboardManager in project android-common by litesuits.
the class ClipboardUtil method getText.
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static String getText(Context context, int index) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = clipboard.getPrimaryClip();
if (clip != null && clip.getItemCount() > index) {
return String.valueOf(clip.getItemAt(0).coerceToText(context));
}
return null;
}
use of android.content.ClipboardManager in project android-common by litesuits.
the class ClipboardUtil method getLatestText.
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static String getLatestText(Context context) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = clipboard.getPrimaryClip();
if (clip != null && clip.getItemCount() > 0) {
return String.valueOf(clip.getItemAt(0).coerceToText(context));
}
return null;
}
use of android.content.ClipboardManager in project Reader by TheKeeperOfPie.
the class EventListenerBase method copyText.
@Override
public void copyText(CharSequence text) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText(context.getString(R.string.comment), text);
clipboard.setPrimaryClip(clip);
toast(context.getString(R.string.copied));
}
Aggregations