tags:

views:

503

answers:

2

Hi, I'm creating an appwidget, where the user should be able to configure it before it is added to the home screen. To me, PreferenceScreen/PreferenceActivity seems perfect for the task, but the intention behind these classes seem to be configuring an actual application. I've searched, but cannot find any documentation or tutorials which covers this question.

Is it possible to configure a widget using these classes, or is the only alternative to configure it through an ordinary view?

Thanks for any answers!

+2  A: 

You certainly can use a PreferenceActivity for this purpose. If you set it up as the android:configure activity in your widget configuration, though, you will have to do a bit of fancy footwork to then get your widget updated.

Here is a sample project from one of my books that demonstrates the technique.

CommonsWare
Wow, thanks a lot! That's what I call a prompt and concise answer. As I'm new here I can't vote up your answer, but I will try to do it when my reputation goes up.Have a nice weekend.
hpe
A: 

Yes, that's the way to go...

I've searched, but cannot find any documentation or tutorials which covers this question.

I don't think so:

Cristian
I didn't stumple over the example from CommonsWare, which seems to cover my question. As far as I can see, the documentation does not cover the use of Preference* for configuring AppWidgets. For example, it does not come with a button (e.g. "Save"), but relies on the user clicking on the back button.
hpe