I've developed a bit in Android before but have never encountered Widgets, until now, and they seem to have some restrictions in whats possible to do with them. So I'm asking for some guidance in how to do things right.
I have ecountered two problems which I don't know how to solve, and Google around on them doesn't give me a united answer.
Problem 1) I have som shared preferences in my application which I would like to be able to set from my widget(toggle function on button). But the only onclicklistener I can attach to the widgets remoteViews are setOnClickPendingIntent() and setOnClickFillInIntent(), I would like to run some methods that does the shared preferences handling when I click on a button. But if I understand this right you can only start a pending intent on click, is it really this restricted? I would like to run some method onclick instead, is this even possible to do and if it is, how is this done best? Also I would like that the widget is updated when user press the button.
Problem 2) Is it possible to update a widget from an activity, and whats the way to go?
NB. I'm not looking for any complete solutions, just best practice tips, hints, small examples or links.