Java Code Examples for android.content.ClipboardManager#setText()

The following examples show how to use android.content.ClipboardManager#setText() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: sctalk   File: MessageAdapter.java    License: Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
@Override
public void onCopyClick() {
    try {
        ClipboardManager manager = (ClipboardManager) ctx.getSystemService(Context.CLIPBOARD_SERVICE);

        logger.d("menu#onCopyClick content:%s", mMsgInfo.getContent());
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
            ClipData data = ClipData.newPlainText("data", mMsgInfo.getContent());
            manager.setPrimaryClip(data);
        } else {
            manager.setText(mMsgInfo.getContent());
        }
    } catch (Exception e) {
        logger.e(e.getMessage());
    }
}
 
Example 2
Source Project: stynico   File: gifa.java    License: MIT License 6 votes vote down vote up
public void ac_styTool()
   {
EditText et=(EditText) findViewById(R.id.mainEditText1);
String os =et.getText().toString();
char[] a = os.toCharArray();
StringBuffer b = new StringBuffer("");
String mo =getResources().getString(R.string.android_gifb); 
for (int i=0;i < a.length;i++)
{
    b.append(mo.replace('n', a[i])) ;
    ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
    manager.setText(b);
}
TextView t=(TextView) findViewById(R.id.mainTextView1);
t.setText(b);
   }
 
Example 3
Source Project: stynico   File: gifa.java    License: MIT License 6 votes vote down vote up
public void clicksvip()
   {
EditText et=(EditText) findViewById(R.id.mainEditText1);
String os =et.getText().toString();
char[] a = os.toCharArray();
StringBuffer b = new StringBuffer("");
String mo ="❦H❧";
for (int i=0;i < a.length;i++)
{
    b.append(mo.replace('H', a[i])) ;
    ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
    manager.setText(b);
}
TextView t=(TextView) findViewById(R.id.mainTextView1);
t.setText(b);
   }
 
Example 4
Source Project: stynico   File: gifa.java    License: MIT License 6 votes vote down vote up
public void eclick()
   {
EditText et=(EditText) findViewById(R.id.mainEditText1);
String os =et.getText().toString();
char[] a = os.toCharArray();
StringBuffer b = new StringBuffer("");
String mo ="‮ ‮ ‮爱";
for (int i=0;i < a.length;i++)
{
    b.append(mo.replace('爱', a[i])) ;
    ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
    manager.setText(b);
}

TextView t=(TextView) findViewById(R.id.mainTextView1);
t.setText(b);}
 
Example 5
Source Project: stynico   File: gifa.java    License: MIT License 6 votes vote down vote up
public void bclick()
   {
EditText et=(EditText) findViewById(R.id.mainEditText1);
String os =et.getText().toString();
char[] a = os.toCharArray();
StringBuffer b = new StringBuffer("");
String mo ="爱҉";
for (int i=0;i < a.length;i++)
{
    b.append(mo.replace('爱', a[i])) ;
    ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
    manager.setText(b);
}

TextView t=(TextView) findViewById(R.id.mainTextView1);
t.setText(b);
   }
 
Example 6
Source Project: stynico   File: gifa.java    License: MIT License 6 votes vote down vote up
public void click()
   {
EditText et=(EditText) findViewById(R.id.mainEditText1);
String os =et.getText().toString();
char[] a = os.toCharArray();
StringBuffer b = new StringBuffer("");
String mo ="ζั͡爱 ั͡✾";
for (int i=0;i < a.length;i++)
{
    b.append(mo.replace('爱', a[i])) ;
    ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
    manager.setText(b);
}
TextView t=(TextView) findViewById(R.id.mainTextView1);
t.setText(b);
   }
 
Example 7
Source Project: stynico   File: gifa.java    License: MIT License 6 votes vote down vote up
public void ua()
   {
EditText et=(EditText) findViewById(R.id.mainEditText1);
String os =et.getText().toString();
char[] a = os.toCharArray();
StringBuffer b = new StringBuffer("");
String mo ="妮̶"; 
for (int i=0;i < a.length;i++)
{
    b.append(mo.replace('妮', a[i])) ;
    ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
    manager.setText(b);
}
TextView t=(TextView) findViewById(R.id.mainTextView1);
t.setText(b);
   }
 
Example 8
Source Project: android-project-wo2b   File: TDevice.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
public static void copyTextToBoard(Context context, String string)
{
	if (TextUtils.isEmpty(string))
		return;
	ClipboardManager clip = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
	clip.setText(string);
}
 
Example 9
Source Project: styT   File: gifa.java    License: Apache License 2.0 5 votes vote down vote up
public void ua() {
    EditText et = (EditText) findViewById(R.id.mainEditText1);
    String os = et.getText().toString();
    char[] a = os.toCharArray();
    StringBuffer b = new StringBuffer("");
    String mo = "妮̶";
    for (char anA : a) {
        b.append(mo.replace('妮', anA));
        ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
        manager.setText(b);
    }
    TextView t = (TextView) findViewById(R.id.mainTextView1);
    t.setText(b);
}
 
Example 10
Source Project: styT   File: gifa.java    License: Apache License 2.0 5 votes vote down vote up
public void ac_styTool() {
    EditText et = (EditText) findViewById(R.id.mainEditText1);
    String os = et.getText().toString();
    char[] a = os.toCharArray();
    StringBuffer b = new StringBuffer("");
    String mo = getResources().getString(R.string.android_gifb);
    for (char anA : a) {
        b.append(mo.replace('n', anA));
        ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
        manager.setText(b);
    }
    TextView t = (TextView) findViewById(R.id.mainTextView1);
    t.setText(b);
}
 
Example 11
Source Project: Aurora   File: DeviceUtils.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
public static void copyTextToBoard(Context context, String string) {
    if (TextUtils.isEmpty(string))
        return;
    ClipboardManager clip = (ClipboardManager) context
            .getSystemService(Context.CLIPBOARD_SERVICE);
    clip.setText(string);
}
 
Example 12
Source Project: styT   File: gifa.java    License: Apache License 2.0 5 votes vote down vote up
public void c_styTool() {
    EditText et = (EditText) findViewById(R.id.mainEditText1);
    String os = et.getText().toString();
    char[] a = os.toCharArray();
    StringBuffer b = new StringBuffer("");
    String mo = getResources().getString(R.string.android_gifa);
    for (char anA : a) {
        b.append(mo.replace('n', anA));
        ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
        manager.setText(b);
    }
    TextView t = (TextView) findViewById(R.id.mainTextView1);
    t.setText(b);
}
 
Example 13
Source Project: stynico   File: KILL.java    License: MIT License 5 votes vote down vote up
@Override
      public void onItemClick(AdapterView<?> parent, View view, int position, long id)
      {
          TextView tv_appName = (TextView) view.findViewById(R.id.tv_app_name);
          TextView tv_processName = (TextView) view.findViewById(R.id.tv_app_process_name);

          String appName = tv_appName.getText().toString();
          String processName = tv_processName.getText().toString();

          Toast.makeText(KILL.this, "已复制" + "应用+进程", Toast.LENGTH_SHORT).show();
	ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
	manager.setText("应用: " + appName + "\n进程: " + processName);
}
 
Example 14
Source Project: styT   File: gifa.java    License: Apache License 2.0 5 votes vote down vote up
public void click() {
    EditText et = (EditText) findViewById(R.id.mainEditText1);
    String os = et.getText().toString();
    char[] a = os.toCharArray();
    StringBuffer b = new StringBuffer("");
    String mo = "ζั͡爱 ั͡✾";
    for (char anA : a) {
        b.append(mo.replace('爱', anA));
        ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
        manager.setText(b);
    }
    TextView t = (TextView) findViewById(R.id.mainTextView1);
    t.setText(b);
}
 
Example 15
public static void onActionMenuItemSelected(String uri, AppCompatActivity activity, LinkAction action){
	switch (action){
		case SHARE:
			shareText(activity, null, uri);
			break;
		case COPY_URL:
			ClipboardManager manager = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE);
			manager.setText(uri);
			break;

		case EXTERNAL:
			try {
				final Intent intent = new Intent(Intent.ACTION_VIEW);
				intent.setData(Uri.parse(uri));
				activity.startActivity(intent);
			} catch(final ActivityNotFoundException e) {
				General.quickToast(activity, R.string.error_no_suitable_apps_available);
			}
			break;
		case SHARE_IMAGE:
			((BaseActivity)activity).requestPermissionWithCallback(Manifest.permission.WRITE_EXTERNAL_STORAGE, new ShareImageCallback(activity, uri));
			break;
		case SAVE_IMAGE:
			((BaseActivity)activity).requestPermissionWithCallback(Manifest.permission.WRITE_EXTERNAL_STORAGE, new SaveImageCallback(activity, uri));
			break;
	}
}
 
Example 16
Source Project: styT   File: ClipBoardUtil.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 实现文本复制功能 
 * 
 * @param content
 */
@SuppressLint("NewApi")
public static void copy(Context context, String content) {
	// 得到剪贴板管理器
	ClipboardManager cmb = (ClipboardManager) context
		.getSystemService(Context.CLIPBOARD_SERVICE);
	cmb.setText(content.trim());
}
 
Example 17
Source Project: Cotable   File: TDevice.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
public static void copyTextToBoard(String string) {
    if (TextUtils.isEmpty(string))
        return;
    try {
        ClipboardManager clip = (ClipboardManager) BaseApplication.context()
                .getSystemService(Context.CLIPBOARD_SERVICE);
        clip.setText(string);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 18
Source Project: Android   File: RequestActivity.java    License: MIT License 4 votes vote down vote up
@OnClick(R.id.address_lin)
void goCopy(View view) {
    ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
    cm.setText(MemoryDataManager.getInstance().getAddress());
    ToastEUtil.makeText(mActivity,R.string.Set_Copied).show();
}
 
Example 19
private void copyToClipboard(String string) {
    ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
    manager.setText(string);
}
 
Example 20
Source Project: Android   File: ModifyInfoActivity.java    License: MIT License 4 votes vote down vote up
@OnClick(R.id.id_ll)
void goId(View view) {
    ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
    cm.setText(userBean.getAddress());
    ToastEUtil.makeText(mActivity,R.string.Set_Copied).show();
}