I’ve been looking around for ways to do this. How could I make it so each instance of a widget that is created has it’s own set of settings (The settings would be the same, just the values different)
So, for example – If I was making a weather application, then one instance of the widget could display the weather for one city and another widget could display the weather for another. Yet, you would still drag the same widget out.
I’ve thought of a few ways, but I’m just not sure how to go about making them happen. For example – I could use SharedPreferences and prefix each setting with the WidgetID. I am not sure if this would work though, and I have no idea how to get the widget id (I’m sure I could find out though.)
So what I am wondering is, is the above solution a good way to do what I am trying to achieve (and will it work) or is there a better way to go about doing this.
Thanks,
shadrxninga
SharedPreferences and prefixes is the right way.
For widgetId you should to watch on AppWidgetManager.