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 Answers1

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)