3

※it's not a App2sd problem.
(at first, you can try this application where android market)
https://market.android.com/details?id=com.beadgrip.premierframe

This is a PictureFrame Widget.
There are two ImageViews in a Widget Layout (2x2 size)
1. Add a widget on the homescreen -> of course appear!
2. Rebooting -> disappear (sometimes appear...very strange problem..)
3. But If I rotate screen -> appear

This problem happned on devices below LG, SamSung, CM7 Roms (and all kinds of 'Home Launcher App')
But, HTC Sense and MIUI are no problem

More Strange thing is..

if I delete one ImageView which in the WidgetLayout XML -> No problem!!!
(or not setImageBitmap where the provider.java source which is one of frame or picture bitmap)

This is the kernel source of question.

provider.java source

// Update Widget Method
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
    PFramePhotoDatabase helper = new PFramePhotoDatabase(context);
    for (int appWidgetId : appWidgetIds) {
        int[] specificAppWidget = new int[] { appWidgetId };
        RemoteViews views = buildUpdate(context, appWidgetId, helper);
        appWidgetManager.updateAppWidget(specificAppWidget, views);
    }
    helper.close();
}

static RemoteViews buildUpdate(Context context, int appWidgetId, PFramePhotoDatabase helper) {
    RemoteViews views = null;
    // Getting a frame, picture from SQLite
    Bitmap bitmap_Pic = helper.getPhotoPicture(appWidgetId);
    Bitmap bitmap_Frm = helper.getPhotoFrame(appWidgetId);
    views = new RemoteViews(context.getPackageName(), R.layout.layout_widget22);

   // If I delete one 'if' it's not problem!, it's perfect!
   // So I devided buildUpdate Method as two kinds, But It's same problem :<
   if (bitmap_Pic != null) {
     views.setImageViewBitmap(R.id.wiv_Picture22, bitmap_Pic); // Picture set a ImageView
   }
   if (bitmap_Frm != null) {
    views.setImageViewBitmap(R.id.wiv_Frame22, bitmap_Frm);  // Frame set a ImageView
   }
   return views;
}
JuHyun Lee
  • 139
  • 1
  • 15

2 Answers2

1

You simply need to call super.onReceive () in your onReceive () method to prevent the broke of the widgets manager lifecycle.

Acuna
  • 1,741
  • 17
  • 20
0

same problem after rebooting, the widgets disappears. I saw this post: http://code.google.com/p/cyanogenmod/issues/detail?id=3167

Quang-Hai P
  • 89
  • 1
  • 4
  • 5
    This is the bad things of pasting links without providing any extra info. You should have explained a bit the answer because the link is broken right now. – GoRoS Feb 18 '14 at 16:16