Android :: AppWidgets - Reusing RemoteViews Instance Leaks Memory?

May 21, 2009

I'm writing a widget. Currently, I'm have a simple ImageView, and calling RemoteViews.setImageViewBitmap(). I'm using a service to do the updates.

I thought it might be a good idea to reuse an existing RemoteViews instance, so I'm only querying it the first time around, and subsequently simply call setImageViewBitmap() with the new image.

This works well initially, but after some time I first start getting "!!! FAILED BINDER TRANSACTION !!!" errors, and later, an OutOfMemory exception.

Simply creating a new RemoveViews instance every time works flawlessy on the other hand. I'm just curios why that would be, any ideas?

Android :: AppWidgets - Reusing RemoteViews instance leaks memory?

Android :: Will Code Cause Memory Leaks?

Aug 3, 2010

Will the code cause a memory leak? Essentially I switch between various layouts in my application using setContentView(), and I have member variables of my activity that maintain references to various views (buttons/text views) on the layouts. Am I correct in thinking that if the activity class has a reference to a button and then changes layouts the layout wont be garbage collected because it will still hold a button reference? If this is the case, can I just null the button variable before changing layouts?

View 3 Replies View Related

Android :: How To Find Where Memory Leaks In Activity?

May 20, 2010

When start Activity A, I found the memory usage of application is about 5MB. Then start Activity B from A via startActivity. In Activity B, I created a thread, and traverse file system in this thread, after traversing completed, call finish() and to return to Activity A. At this time, I found the memory usage of application is about 8MB (GC is forced before check memory usage). How to find Where memory leaks? By the way, I checked the memory usage with DDMS.

View 5 Replies View Related

Android :: List View And Memory Leaks

Oct 23, 2010

I have a very simple application which has a problem with getting ListViews to be freed by the GC. i have a ViewGroup which has a ListView. When the page with the ViewGroup no longer has any references to it, and I force a GC, the ListView is not freed. The project in question is quite small and can be found at If you run it, the first page has a button and a ListView (which has no items so you cannot see it). When you press the button it switches to a second page which has just a button. When you press the button on the second page, it creates a new ViewGroup and ListView and sets that as the current view. Thus, every time you switch pages, a new ViewGroup/ListView is created, and all references to the old one go away. Hence the old one should be GC'd. However if you switch views 20 times and then force a GC you will see that the ListViews are never freed (i.e. their finalize method (which is logged) is not called). Now here is the really weird part. This happens ONLY if I build my project using Eclipse. If I use Ant to build and install the project, the ListViews are all freed when I do a GC as you would expect. Why would the Eclipse version exhibit this behavior?

View 7 Replies View Related

Android :: Memory Leaks With List View

Oct 20, 2010

I have a class 'GListView' which extends ListView and acts as it's own adapter. It is declared thus: public class GListView extends ListView implements List Adapter In it's constructor, I set it's adapter to itself

View 2 Replies View Related

Android :: Register Callback Leaks Memory?

Mar 5, 2010

I was trying to find out were my apps memory was being leaked and was able to discover that when calling registerCallback(...) it would lead to a memory leak after a screen orientation change. What could be some possible things that are causing the leak? I've tried many things. And I do have a unregisterCallback(..) call.

View 20 Replies View Related

Android :: References To A Context And Memory Leaks

Jul 27, 2010

I've read that it is a mistake and a source of memory leaks in Android application to keep a long-lived references to a Context.

But I don't understand if it is ok to create an class that looks like this one:


And call it from an Activity:


View 2 Replies View Related

Android :: 'Avoiding Memory Leaks' Article In Blog

Apr 10, 2010

I just read the article 'Avoiding memory leaks' in android blog written by Romain Guy.

View 4 Replies View Related

Android :: Trace Memory / Window Leaks In Droid?

May 17, 2010

How to trace the Memory Leaks in Android Development? I am working on eclipse IDE to develop the application. i cant find out how to rectify the memory or window Leaks Exceptions? Any Idea.

Mainly the Window Leaked error raises the Illegal Argument Exception? how to rectify both og this.

View 1 Replies View Related

General :: How To Find Which Apps Cause Memory Leaks

Apr 22, 2013

Any user friendly android app which can effectively show which apps cause memory leaks on a phone?

I can only find developer tools to detect memory leaks within apps like Eclipse MAT. Sadly I'm not a developer so I would rather prefer just a list of apps to uninstall and not the exact cause of memory leak within a specific app.

View 6 Replies View Related

Android :: Android Tools And Methods Work Best To Find Memory - Resource Leaks

Jul 18, 2009

I've got an Android app developed, and I'm at the point of a phone app development where everything seems to be working well and you want to declare victory and ship, but you know there just have to be some memory and resource leaks in there; and there's only 16mb of heap on the Android and its apparently surprisingly easy to leak in an Android app.

I've been looking around and so far have only been able to dig up info on 'hprof' and 'traceview' and neither gets a lot of favorable reviews.

What tools or methods have you come across or developed and care to share maybe in an OS project?

View 3 Replies View Related

Android :: Android Application Memory Leaks

Dec 23, 2009

I am using kind of results search engine, problem is to remember the searching criteria i made singleton static class which keeps only one instance.In my application there are lots of class level private variables, lots of public static variables, a big util class which contains only static final methods.problem is my application get crash any time any where any spot and interesting thing is crash code always surrounded by try{} catch(Throwable e){} block but never catch, i think it may be memory full issue. I want to discuss one sample case, on the result page i also display result related image, i download image from web and using drawable i place image in the imageview, i created static hashmap to reuse images, some time after downlaod 5 images application crash some times click on a result get user to new detail screen get crash and all code surrounded by try catch block, i am new to mobile program this thing has become night mare to me. Last thing, On emulator hardly application crash but when i try to test the application on device, i am using samsung glaxy android supported to test the application it goes smoth and suddenly it start getting crashed, and after crash android relaunch the activity that throws null pointer exception on every click and caught by try{}catch{} block i think after crashing android dealocate all objects only keep the UI objects thats why when after crash i auto launch the activity clicking causes null pointer can i stop relaunching crashed activity?

View 1 Replies View Related

Android :: How To Identify Memory Leaks In Android?

Aug 12, 2010

I have developed a simple application before testing it i want to check whether any memory leaks are there in the application. I don't know how to identify the leaks in Android. I am using Eclipse IDE for development. Is there a good introduction into finding memory leaks in Android apps somewhere?

View 2 Replies View Related

Android :: Detecting Memory Leaks In Android

Sep 22, 2010

How to detect Memory leaks in Android JNI code? I am using Froyo

View 1 Replies View Related

Android : Keeping A Bitmap In Memory With Retain Non Configuration Instance()

Jul 24, 2010

I have a large bitmap that i would like to keep in memory when the qwerty keyboard is visible. My app is always in landscape, so this is the only configuration change that will cause a reDraw. I heard this is what onRetainNonConfigurationinstance() is for...but cant figure it out. Can someone point me in the right direction?

View 1 Replies View Related

Android :: ImageSpan Not Supported In RemoteViews?

Dec 7, 2009

One of the component of my app widget is TextView which i want to be filthy rich one: ForegroundSpan seems to be working but i cannot see ImageSpan to appear.

View 2 Replies View Related

Android :: RemoteViews And SetEnabled - When Is It Supported

Jul 23, 2010

I have a widget, working happily on 2.2, which includes this line:


When I run it on 1.5, I get this:


Unsuprisingly, the widget doesn't appear. But I'm not quite sure what is not supported here. RemoteViews.setBoolean is documented as supported since API level 3, and ImageButton.setEnabled has been there forever.

Is there some separate question about which functions setEnabled is prepared to do business with ? Or, if not, what could possibly be wrong here ?

View 5 Replies View Related

Android :: How To Add EditText Field To An AppWidget - RemoteViews

May 14, 2009

I am trying to add a "EditText" Field to an AppWidget. I took the AppWidget example from here: oid/apis/appwidget/index.html and modified it by replacing the TextView with a EditText. It doesnt work... Compiles and runs but the Widget sais "Problem loading Widget" when it shows up.

Maybe an example? Is the default Google Search Widget open source? Can someone give ma a link to the source?

View 6 Replies View Related

Android :: Reusing The Same Location Manager

Sep 14, 2010

I have a few activities within an app.

Should i be reusing the same location manager or should i call (LocationManager) this.getSystemService(Context.LOCATION_SERVICE) for each new activities?

View 2 Replies View Related

Android : AppWidget's RemoteViews Be Edited / Created Dynamically - Only From XML?

May 28, 2010

I suspect the answer is no, but it only seems possible at the moment to update an AppWidget via a RemoteViews object which is inflated from a static XML file.

Is there any way to build a RemoteViews object on the fly, or edit the layout of one that is already there?

The requirement is that I don't know until runtime exactly how many ImageViews I want to display in my AppWidget.

Currently I am setting all the ImageViews I may need in the layout XML file as invisible and then just making the ones I want visible, but am I then limited to what I have in the XML file to start with. It would be far more convenient to be able to just add the ones I need on the fly, and set their properties when updating.

Anyone know if there is a way to do that?

View 5 Replies View Related

Android :: Reusing Code And Resources From Another Project

Dec 10, 2009

I have project A with some classes and some resources (used for classes configuration). I'd like to reuse its classes (and resources necessary for them) in another project B (and possibly in more projects). Currently I have 2 projects in Eclipse and they both builds fine, but when project B is started in emulator it fails with error.It should get classes and resources from both projects and package them together. 2) Make a third project which consists of symbolic links to classes and resources of those two projects. 3) Make project A as a service and consume it in project B. They all are imperfect: - 1 and 2 would pack classes and resources of project A into the .apk of project B. - 3 has performance penalty and reuse is not so easy.

View 16 Replies View Related

Android :: Reusing Intents With Notification / Pending

Nov 19, 2009

In my app, user starts a service and shows a notification from activity A. The notification creates a Pending Intent that will invoke activity A should the user tap on it. The problem with this behavior is that, if the user starts the service (which shows the notification), drags down the notification bar, then taps the notification, I now have two activity A's in the display stack, one on top of the other and both exactly the same. How can I re-use the original activity A in this situation so the user isn't duplicating activities?

View 4 Replies View Related

Android :: Potential - Bug In The Implementation Of AppWidgets

Nov 10, 2009

We have discovered a potential bug in the implementation of AppWidgets. Here is a simple reproducer.

Attached is the code for an application containing a TestActivity and a TestWidget. TestActivity extends MapActivity and TestWidget is a simple widget provider which updates a TextView every 2 seconds. Now if the TestActivity is launched with no instance of TestWidget running, it works just fine. But if the TestActivity is launched after placing the TestWidget on the home, it results in ClassNotFoundException. Here is what we get:


So it seems we have an inconsistency in the way the class loader works for the same apk.

WORKS - Launch the application by itself, without invoking the Widget. DOES NOT WORK - Create a Widget on the Home screen and then launch the application from the launcher.

The source code for this application ( download/TzY3ZGVhZy96NE4zZUE9PQ) has been attached. Hope someone from the Android team can shed light on this behavior.

This error is seen on the 1.5r3 SDK. Not sure if this has been addressed in 1.6 and 2.0 SDKs..

View 2 Replies View Related

Android :: Debugger Not Working For AppWidgets?

May 8, 2009

I'm trying to make an AppWidget, and for some reason the Eclipse debugger doesn't suspend on any of the breakpoints I set (but I know the code is executed because I see it working on the emulator). I don't have this problem with other 'regular' apps (non AppWidgets). Is this a known limitation, or is it just a problem on my installation?

View 4 Replies View Related

Android :: Handling Orientation Changes In AppWidgets

Apr 18, 2010

We have created an AppWidget that takes user inputted text into an EditText and displays a calculated amount of text inside a TextView on the Home Screen. We calculate the amount of text based on the AppWidgetInfo.minWidth, minHeight attributes. We do this to simulate scrolling; we cut up the user-inputted text into chunks that will fit into the widget and swap them based on button clicks.

When we save the widget with the device in Landscape mode, it calculates the appropriate amount of text for Landscape mode and displays it in the widget. The problem is when the user changes orientation of the device to Portrait mode (without opening the widget and resaving the text), the calculated amount of text for Landscape mode is still displayed. This also happens in the vice versa case (the user is in Portrait and saves, etc.)

How can we tell our AppWidget to recalculate the amount of text displayed on screen orientation change? Is this possible? How would you solve this problem?

View 5 Replies View Related

Android :: AppWidgets Restricted To Particular Sizes?

Sep 17, 2010

I'm making an Android AppWidget to sit on the home screen.

The user's home screen space is precious, so I want the widget to be small. The ideal size would be 2x1 cells.

Some documentation suggests you can have any size you like?
But the AppWidget graphical design guidelines imply that only standard sizes are supported: 4x1, 3x3, 2x2.

Does that refer to the available PhotoShop templates or is it a limitation of Android itself?

I'm finding that a 2x1 widget works on my actual device (HTC Wildfire) but expands to 2x2 on the emulator.

HTC have their own special implementation of the home screen, so maybe my widget will only work at 2x1 on HTC devices?

Is there any way to create a 2x1 widget, or should I use a standard size?

My widget was adapted from the Simple Wiktionary sample.

The manifest has android:minWidth="146dip" and android:minHeight="72dip".
There's a RelativeLayout with android:layout_width="fill_parent" and android:layout_height="wrap_content"

I'm just starting with Android, so apologies in advance if this is a silly question. :)

View 1 Replies View Related

Android :: Reusing Java Source In Multiple Projects

Nov 24, 2009

I'm currently developing for Android using Eclipse. I have a lexicon viewer application (with package name "com.mycompany.myviewer") that I want to reuse multiple times, just changing specific resources such as app name and icons.For example, I have a certain publisher "Publisher1", who publishes the lexicons "Lexicon1" and "Lexicon2". I would need to two applications: App1 with certain name and icon, and App2 with another name and icon.What is the best way of doing this in Java? In visual Studio (and C++) I could create two projects based on the lexikon viewer app and use conditional resources to get the right name and icon. Is there some way of doing something similar in Java?

View 2 Replies View Related

Android :: Create Customized Views For AppWidgets?

Jan 22, 2010

There is a given set of predefinied Views that can be used in layouts for AppWidgets. How can a customized View added to this list?

The minimum requirement is that the class is annotated with RemoteView. What else is necessary to be acceptable as view in the layout.xml?

View 2 Replies View Related

Android :: Programmatically Create / Destroy AppWidgets?

Mar 5, 2010

Is it possible to programmatically create and/or destroy AppWidgets?

View 7 Replies View Related

Android :: Reusing Phone's Pattern Lock Screen From Application?

Oct 31, 2010

I am writing a application and it should be protected with a password. Instead of building a new one, Is it possible to use the Android's Pattern lock screen from application with different patterns?

View 1 Replies View Related

Copyrights 2005-15, All rights reserved