I have been experimenting with widgets for a few days, and I needed a
simple abstract means of saving the widget state.
I want to be able to do something like the following:
private void updateAppWidget(String name, String dob)
{
//create a widget model with its own data
BDayWidgetModel m = new BDayWidgetModel(mAppWidgetId,name,dob);
//paint it
updateAppWidget(this,AppWidgetManager.getInstance(this),m);
//save it for next time
m.save(this);
}
To accomodate this I have used a widget model abstraction where a
derived widget model will identiy some of its members as persistable
and knows how to set them back when retrieved.
This allowed me to quickly accomodate all kinds of widget models and
not think about persistence model all the time.
Anyway, if you want to get to the source code you can use the following link
http://www.knowledgefolders.com/akc/display?url=DisplayNoteIMPURL&reportId=3307&ownerUserId=satya
Now this is a very drafty work around or framework, however you deem
to call it. I can see a handfull of variants that can make this lot
bettter, but this is quick and dirty for your experimental work.
Hope this is useful to someone
Satya
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---