Re: [android-developers] Re: Appwidget and orientation

2011-05-05 Thread Kostya Vasilyev
This looks fragile - it depends on the service to keep running forever, which is 1) a bad idea 2) may not last long, especially on Android 2.0 and later. It also does not help if the Launcher is kicked out of memory, which is a rare event, but does happen sometimes. My preferred solution is

Re: [android-developers] Re: Appwidget and orientation

2011-05-05 Thread Niall
Does what you suggested mean that all the brunt work is performed by the service, and that this merely passes a RemoteViews to the appwidget for displaying etc? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send

Re: [android-developers] Re: Appwidget and orientation

2011-05-05 Thread Kostya Vasilyev
Not specifically. It's not about where you push the RemoteViews from, it's about what's in it. What I do in my code is make sure that each and every RemoteViews object is complete, i.e. has calls to show data (setTextViewText, etc.) as well as set any pending intents. Whenever something

Re: [android-developers] Re: Appwidget and orientation

2011-05-05 Thread Niall
I think I understand you... but I'm not sure that I do completely. Having not used services for updating (or for managing updates) let me first ask what you mean by pushing updates so I don't misunderstand. Does that mean that in a service I instantiate an appWidgetManager, and then call its

Re: [android-developers] Re: Appwidget and orientation

2011-05-05 Thread Kostya Vasilyev
05.05.2011 14:22, Niall ?: I think I understand you... but I'm not sure that I do completely. Having not used services for updating (or for managing updates) let me first ask what you mean by pushing updates so I don't misunderstand. By pushing an update I mean: 1 - Instantiating

Re: [android-developers] Re: Appwidget and orientation

2011-05-05 Thread Niall
Thanks for taking the time to explain. I think I understand it much better now. And I think it also makes sense, which is nice too :) I may come back here if I have more questions, but I think not. -- You received this message because you are subscribed to the Google Groups Android

Re: [android-developers] Re: Appwidget and orientation

2011-05-05 Thread Niall
Just another quick question. I want to keep track of update-to-update changes. So I have a ListListint variable containting my data (which I've parsed from the net). At the end of updating I copy this value to another variable. I need to keep track of these variables. Does it make more sense

Re: [android-developers] Re: Appwidget and orientation

2011-05-05 Thread Kostya Vasilyev
AppWidgetProvider objects are transient, can be destroyed very quickly after they're needed (for onUpdate, etc.). Because of this, storing data there is pretty much useless. Using the service is better, but services can be stopped (by the system or by the user). I recommend making a static

Re: [android-developers] Re: Appwidget and orientation

2011-05-05 Thread Niall
Suppose I have a status notification TextView on my appwidget. During my big update function (that returns the single RemoteViews object) would be be OK to call a method that'd update the value of the text? Like: void updateStatus( String str ) { // update the status text R.id.statusUpdate

Re: [android-developers] Re: Appwidget and orientation

2011-05-05 Thread Kostya Vasilyev
It would be Ok, as long as: - updateAppWidgetLayout constructs a single RemoteViews; - this RemoteViews is passed into updateStatus; - updateStatus calls remoteViews.setTextViewText. You can call setTextViewText multiple times on a *single* RemoteViews, but that's kind of pointless, because

[android-developers] Re: Appwidget and orientation

2011-05-04 Thread Niall
Found this that suggests creating an activity that detects the orientation change. Is that the best way to get around it? http://stackoverflow.com/questions/3503114/after-orientation-change-buttons-on-a-widget-are-not-responding -- You received this message because you are subscribed to the

[android-developers] Re: Appwidget and orientation

2011-05-04 Thread Niall
Ok. I was wrong in my first post about the error not being displayed. The appwidget did indeed just default to the initial value. I solved the issue (I think) by doing the following: public static class orientationDetectionService extends Service { @Override public void onStart( Intent