views:

24

answers:

1

I have a widget with a button and a text field. when the user clicks on the button I'd like to copy the text from the textfield to the cliboard. As this is a widget I have to used remoteviews and pending intent. Does anybody has a simple way to do it ?

A: 

I have a widget with a button and a text field.

No, you don't. You have an app widget with a Button and a TextView. EditText is not supported by app widgets. If you have evidence to the contrary, please upload a project somewhere so I can examine it.

Does anybody has a simple way to do it ?

Even if EditText were supported, there is no way to get the value out of it at runtime, since it is not in your application.

CommonsWare
My bad. I have a textview. But I still want to copy the value of the textview to clipboard when I press the button. Is there a specific intent for that or should I use a service ?
PinouinFictif
Not sure if this is the most elegant way, but I created an intent that triggers an activity which reads from the textview and copies to clipboard. The activity is themed with "@android:style/Theme.Dialog" to display a confirmation that the text has been copied
PinouinFictif