Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi this is my activity
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.word);
        et =(EditText)findViewById(R.id.et);
        btnz =(Button)findViewById(R.id.btnz);
        btncopy =(Button)findViewById(R.id.btnc);
        tv =(TextView)findViewById(R.id.textView8);
        btnz.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String name =et.getText().toString();
                Typeface myfont=Typeface.createFromAsset(getAssets(), "ComialUnicoder.ttf");
                tv.setText(name);
                tv.setTypeface(myfont);

            }
        });
        btncopy.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
                ClipData clip = ClipData.newPlainText("ComialUnicoder.ttf",tv.getText());
                clipboard.setPrimaryClip(clip);

            }
        });

    }

when click to btnc copy in text view but without font
i want when click to btnc copy text with font
what is solution?

What I have tried:

search in internet?search in internet?search in internet?
Posted
Updated 24-Jul-16 2:58am

1 solution

You need to save all information relating to the item that you are putting on the clipboard. This is described in the section titled "Implementing Copy or Drag" at ClipData | Android Developers[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900