Beispiel #1
0
 public static void set(Context context, String text) {
   if (!VipApplication.getInstance().lockLooper) {
     Looper.prepare();
     VipApplication.getInstance().lockLooper = true;
   }
   ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
   cmb.setText(text);
   Log.v("DEV", "Clipboard set:" + text);
 }
Beispiel #2
0
  public static String get(Context context) {
    if (!VipApplication.getInstance().lockLooper) {
      Looper.prepare();
      VipApplication.getInstance().lockLooper = true;
    }
    ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
    String data;
    if (cmb.getText() == null) {
      data = "";
    } else {
      data = cmb.getText().toString();
    }

    return data;
  }