语言

Menu
Sites
Language
How to copy text to system clipbard?

Hello,

Could you please suggest how to put some text to clipboard? 

I don't use any editor, I just need to copy text string which is stored in some variable to system clipboard.

 

Thank you in advance,

Maria

响应

3 回复
Alex Dem

Hi,
Afaik, some functionality for copying into clipboard is presented for context menu of WebView. If you will add item to context menu using 'ewk_context_menu_item_append' with Ewk_Context_Menu_Item_Tag = EWK_CONTEXT_MENU_ITEM_TAG_COPY_LINK_TO_CLIPBOARD you should be able to copy opened link into clipboard.
I did not face with api to copy some text into clipboard directly. But maybe someone else could provide such useful info.
Alexey.

Manos Theocharopoulos

Hi,
You can use the the preference API.

#include <app_preference.h>

//Save text 
preference_set_string("virtualClipboard","My text to save");


//Retrive the text
char* myText = NULL;

preference_get_string("virtualClipboard",&myText);

 

 

 

Jean Yang

I don't find such api in tizen IDE help. Seems tizen don't provide such api currently.

preference api, I think it just only to store the data permanently in its private storage, only can be read/write by the app self. if you want to transfer the data to other app, it's not ok, you can use the app_control api.