Kozinak196 / emweather

Automatically exported from code.google.com/p/emweather
0 stars 0 forks source link

Widgets turns black after orientation change or entering car mode #39

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
We had a strange effect under Android 2.3. This was observed with modified code 
(Frankfurt Airport Noise Widget, if you want the code just let me know). We 
want to contribute our bug fix back to you if you ever observe the same thing.

With the full size widget the whole widget turned into its basic look (without 
icons, temperatures etc) as it is defined in the XMLs whenever we entered car 
mode, or returned. Sometimes also in normal operation.

In WidgetForecastService new RemoteViews are newly created several times like 
this:
        remote_viewer.setImageViewBitmap(getWidgetResource("full_widget_image_icon_4"), ((BitmapDrawable)EmWeather.getIconDrawable(context, icons[4])).getBitmap());

//      appWidgetManager.updateAppWidget(appWidgetId, remote_viewer);              
//      remote_viewer = new RemoteViews(getApplicationContext().getPackageName(), 
R.layout.full_widget);

        remote_viewer.setTextViewText(getWidgetResource("full_widget_text_icon_5_day"), days[6]);   

We removed that (see lines commented out) and the bug was resolved.

If you have any questions please let me know.

Original issue reported on code.google.com by pmerl...@googlemail.com on 15 Feb 2012 at 11:23

GoogleCodeExporter commented 8 years ago
Thanks so much for this comment.  You are right about the RemoteViews object 
being created several times.  I added this because on some devices the widgets 
were not being fully redrawn when using a custom drawable (setImageViewBitmap). 
 After hours of hair-pulling and cursing I found that other people had the same 
issue which had to do with the speed of the garbage collector I think.  These 
extra, redundant lines, force the GC to work fast enough.  I am reluctant to 
change this in order to fix the orientation change on 2.3 (I'm not seeing it on 
4.0 and 4.1).

Are you still experiencing this problem?

Again, thanks for the detailed description, I am going to keep this open to see 
if I need to try and find a different workaround for the widget updating.

Original comment by emweat...@gmail.com on 13 Dec 2012 at 6:35

GoogleCodeExporter commented 8 years ago
fixed in 1.0 of the paid version.

Original comment by emweat...@gmail.com on 12 Jan 2013 at 6:06