1

I try to create a widget on Android, showing a dynamically generated image, bigger than the widget.

1. How I did

This can be done with a ListView, and the adapter is a RemoteViewsService where I build my bitmap. Then I create a RemoteViews, and I call setImageViewBitmap with my bitmap. It's working, the widget displays well my image width a vertical scroll (what I want !).

Widget => ListView => setRemoteAdapter(RemoteViewsService) => getViewAt() => RemoteViews => create a view and retrieve bitmap => setImageViewBitmap

2. My memory problem

When the widget is resized, I redraw the bitmap and do the job again (Image depends on widget size). And I see memory growing each time up to out of memory...

Thanks for your help.

rcperso
  • 490
  • 5
  • 10

1 Answers1

0

Maybe it could be useful for someone.

Before :

Create view and retrieve the bitmap

Solution :

Create directly the Bitmap. setImageViewBitmap works without loosing memory :-)

rcperso
  • 490
  • 5
  • 10