Clipboard Capture for Android Web Browser

Do you know any way to connect to the Android web browser so that I can select, copy and paste the contents of the web page programmatically?

+4
source share
2 answers

The selected text in the stock Android Browser is copied to ClipBoard. Use ClipBoardManager to get copied text (for example, below).

ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); String text = clipboard.hasText() ? clipboard.getText().toString() : ""; 
+2
source
 ClipboardManager clipboardManager = (ClipboardManager)getSystemService(CLIPBOARD_SERVICE); if (clipboardManager.hasText()) { Toast.makeText(getApplicationContext(), "Clipboard Text = " + clipboardManager.getText().toString(), Toast.LENGTH_LONG).show(); clipboardManager.setText(null); } else { Toast.makeText(getApplicationContext(), "No Content in Clipboard. So set some text in clipboard", Toast.LENGTH_LONG).show(); clipboardManager.setText("AndroidPeople.com"); Toast.makeText(getApplicationContext(), "Clipboard Text = " + clipboardManager.getText().toString(), Toast.LENGTH_LONG).show(); } 
0
source

Source: https://habr.com/ru/post/1342510/


All Articles