0

I have created a WebView, I want to be able to copy the content of the webview with formating to the clipboard.

recipeDescription.getText().toString Didn't work because the recipeDescription is a WebView not a String.

 btnCopy.setOnClickListener(new View.OnClickListener(){
 @Override
 public void onClick(View view){
 ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
 ClipData clip = ClipData.newPlainText("recipeDescription", X); //What I should be writing instead of X to get the text from recipeDescription Webview?
 clipboard.setPrimaryClip(clip);
 Toast.makeText(ActivityRecipesDetail.this,"recipeDescription Copied",Toast.LENGTH_SHORT).show();
 }
 });

1 Answer 1

0

After several tries I figuration half the solution X = htmlData.text(), htmlData.text() however the formatting is incorrect (copy all content in one line No break lines)

answered Oct 12, 2022 at 19:24
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.