Looks like I finally solved it. It was linked to some variables I kept for the whole runtime of the service (context and stuff like that). Now that I'm not using them as class variables but local ones in the functions it works.
Cheers Moritz On Jan 6, 11:14 am, Moritzz <[email protected]> wrote: > I tried it but it didn't change a thing. The images are pretty small > (just a few kilobyte as they are application icons) anyway. But I > figured something new out: If I continue to load them, I finally get > an OutOfMemoryException as mentioned in some sources and threads I > already read, including yours. Thing is, I have no clue how to find my > mistake(s) in the code and fix them. So here's some of my code: > > First the function to get the images: > > private Bitmap getIconFormServer(String url) { > Bitmap bm = null; > HttpClient httpClient = new DefaultHttpClient(); > HttpGet getMethod = new HttpGet(url); > HttpResponse response; > getMethod.setHeader("Accept", "application/json"); > getMethod.setHeader("Content-type", "application/json"); > getMethod.setHeader("Accept-Encoding", "gzip"); > try { > response = httpClient.execute(getMethod); > InputStream inputStream = response.getEntity().getContent(); > Header contentEncoding = response.getFirstHeader("Content- > Encoding"); > if (contentEncoding != null && contentEncoding.getValue > ().equalsIgnoreCase("gzip")) { > inputStream = new GZIPInputStream(inputStream); > } > bm = new BitmapDrawable(inputStream).getBitmap(); > } catch (Exception e) { > return null; > } finally { > getMethod.abort(); > inputStream.close(); > } > return bm; > > } > > This one is called inside the service that's supposed to update the > widget. So I'm getting my pictures and update the widget out of the > service with > > context = getApplicationContext(); > thisWidget = new ComponentName(context, XWidget.class); > widgetManager = AppWidgetManager.getInstance(context); > widgetView = new RemoteViews(context.getPackageName(), > R.layout.widget); > > and then later: > > widgetView.setImageViewBitmap(id.getButton(), bitmap); > widgetManager.updateAppWidget(thisWidget, widgetView); > > Cheers > > Moritz > > On Jan 5, 6:43 pm, Albert <[email protected]> wrote: > > > The problem is probably that the images are too big and android cant > > handle it. Try this solution I used when I had the same problem: > > >http://groups.google.com/group/android-developers/browse_thread/threa... > > > Hope it helps, > > > Alberto > > > On Jan 5, 4:17 pm, Moritzz <[email protected]> wrote: > > > > I now tried to get some more information but nothing I found helped so > > > far. I also tried to encircle it some more but it won't work. Does > > > nobody have an idea or sthg? > > > > Cheers > > > > Moritz > > > > On Jan 4, 9:51 pm, Moritzz <[email protected]> wrote: > > > > > I forgot to add that after this message, the widget is not updated > > > > anymore. It stays the way it looks like in the moment the message > > > > appears and even when I force another update, it's not changed > > > > anymore. If I remove and add it again, it works for a while, until the > > > > message appears again. > > > > > On Jan 4, 9:41 pm, Moritzz <[email protected]> wrote: > > > > > > Hello, > > > > > > I currently have a lot of problems with this error. I programmed a > > > > > widget and a service that runs in the background. This service is > > > > > updating the widget on different occasions (position changed, screen > > > > > turned on, timer based...) with images and text it's loading from a > > > > > server. After a couple of updates I always get an error from the > > > > > JavaBinder, at least that's what DDMS says. Reproducing the problem > > > > > with my app is quite easy but I just can't figure out what's going on > > > > > there. Can someone please give me some help or hints with that? That'd > > > > > be really cool! > > > > > > Cheers > > > > > > Moritz- Hide quoted text - > > > > - Show quoted text -
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

