Copy text to Clipboard in Android


Warning: Undefined array key "ssba_bar_buttons" in /home/www/igomobile/wp-content/plugins/simple-share-buttons-adder/php/class-buttons.php on line 598

Warning: Undefined array key "ssba_bar_buttons" in /home/www/igomobile/wp-content/plugins/simple-share-buttons-adder/php/class-buttons.php on line 598

Warning: Undefined array key "ssba_bar_buttons" in /home/www/igomobile/wp-content/plugins/simple-share-buttons-adder/php/class-buttons.php on line 598

Warning: Undefined array key "ssba_bar_buttons" in /home/www/igomobile/wp-content/plugins/simple-share-buttons-adder/php/class-buttons.php on line 598

Warning: Undefined array key "ssba_bar_buttons" in /home/www/igomobile/wp-content/plugins/simple-share-buttons-adder/php/class-buttons.php on line 598

Copy some text to a clipboard in Android is pretty simple. Use a code snippet below:

private void CopyNumber(String someText, Context context) {
     ClipboardManager clipMan = (ClipboardManager)context
                    .getSystemService(Context.CLIPBOARD_SERVICE);
     clipMan.setText(someText);
}

context parameter is required if you want to use the function outside Activities