Android Question Runtime connect widget to a service


Hello! I am working to a project for creating and recalling sound profiles on my android.
My question is: it is possible to "connect" a service to a widget in the moment of adding this widget to homescreen? in other words, when i add a widget to homescreen, a list of radiobuttons appear and i will select which profile to connect to that widget from that moment.

I hope you get the idea. Any fragment of code would be very apreciated.

Thank you in advance for any help.


Thank you very much, Erel, i almost made it. But i have the following behaviour:

long click on homescreen -> widgets -> event raised instant when i touch widget icon -> widget appears. No need that.

Instead, i need:
long click on homescreen -> widgets -> long press widget icon -> event raised (startactivity, layout appears, select radio button, do whatever i need, etc) -> widget appears on homescreen.

Thank you very much for help and patience.
Upvote 0