Code example for ClipboardManager

Methods: getTexthasText

0
 
	} 
	 
	private boolean insertClipboardTextAtSearchCursor() { 
		ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
		if (clipboard.hasText()) {
			String clipboardText = " " + clipboard.getText().toString() + " ";
			 
			int start = mSearchBox.getSelectionStart();
			int end = mSearchBox.getSelectionEnd();
			mSearchBox.getText().replace(Math.min(start, end), Math.max(start,end), clipboardText, 0, clipboardText.length());
			return true; 
		} else { 
			Log.d("MinimalistSearch","clipboard reports no text");
			return false; 
		} 
		 
	} 
	 
	@Override 
	protected void onCreate(Bundle savedInstanceState) {