Android :: I Can't Get Rid Of This Error Message: Activity <App Name> Has Leaked ServiceConnection <ServiceConnection Name>@438030a8 That Was Originally Bound Here
Jan 2, 2010
I'm working on my first Android app, so I apologize if this is extremely obvious. I've got three activities in my app, and the user switches back and forth pretty frequently. I've also got a remote service, which handles a telnet connection. The apps need to bind to this service in order to send/receive telnet messages.
I have re-written my code in light of your clarification on the difference between using bindService() as a stand-alone function or after startService(), and I now only get the leak error message intermittently when using the back button to cycle between activities.
My connection activity has the following onCreate() and onDestroy():
CODE:..........
So the service is started when the activity is started, and stopped when the activity is destroyed if no successful telnet connection was made (connectStatus == 0). The other activities bind to the service only if a successful connection was made (connectStatus == 1, saved to a shared preferences). Here is their onResume() and onDestroy():
CODE:.............
So the binding happens in onResume() so that it will pick up the changed state from the connection activity, and in the onDestroy() function it is unbound, if necessary.
But I still get the memory leak error message "Activity has leaked ServiceConnection @438030a8 that was originally bound here" intermittently when switching activities. What am I doing wrong?
Full error message follows (from the revised code):
CODE:..........
I did as you suggested and added an onUnBind() override to the service. onUnBind() is actually only triggered when all clients disconnect from the service, but when I hit the home button, it executed, then the error message popped up! This makes no sense to me, as all the clients have been unbound from the service, so how could the one destroyed leak a serviceConnection? Check it out:
CODE:..................
I thought it might be something like you said, where the binding to the service is not complete when unbindService() is called, however I tried calling a method on the service as I backed through each activity to verify that the binding is complete, and they all went through fine.
In general, this behavior doesn't seem related to how long I stay in each activity. Once the first activity leaks its serviceConnection, however, they all do as I back through them after that.
One other thing, if I turn on "Immediately destroy activities" in Dev Tools, it prevents this error.
View 3 Replies
Sep 14, 2009
As a point of example for my problem, I wrote a single Activity which binds to a service and then accesses a property to display. The problem is that my TestServiceConnection.onServiceConnected method is never called, and I don't know why.
Here is the code:
CODE:......................
View 3 Replies
View Related
Apr 12, 2010
Is there a way to find out if an activity is bound to a service? Something like boolean isBoundToService(ServiceConnection sc)?
Sometimes when I play around with my app I get an exception when it tries to unbind a service which is not bound.
View 1 Replies
View Related
Nov 11, 2010
so the application I've written has a service (that tracks GPS data) with a single main activity that binds to it with bindService in it's onStart() method, and unbinds from the service in it's onStop() method using unbindService( ServiceConnection ). I also have an activity which is an options screen, that is launched by pressing a button on the main activity. On this options screen, I have a checkbox that says "Run in background", which, if set to true, means that when the user exits the application with eier the Home or Back buttons, the service will continue running, not turning the GPS off. I do this by calling this.startForeground onUnbind, and this.stopForeground onRebind, if the setting is set to true, and stopping and starting my location reader onUnbind and onRebind respectively if the setting is false. If the service is running in the background, it also displays a notification to ensure the user understands that the GPS is still running and draining their power. This notification is displayed and stopped by relying on the startForeground and stopForeground methods......
View 1 Replies
View Related
Oct 2, 2009
Is the 'Activity leaked window' issue (http://code.google.com/p/ beepmystuff/issues/detail?id=3) fixed in any of the latest Android releases? I'm not sure about the Android version I'm using. I get this error during orientation changes. I create PopupWindows inside TextView. When I change orientation when the popupwindow is shown, my log says Activity has leaked a window (popupwindow) and then sometimes the application crashes, but not always. When the application crashes, the log says 'Uncaught handler: thread main exiting due to uncaught exception java.lang.IllegalArgumentException: View not attached to window manager'
View 11 Replies
View Related
Jan 30, 2009
I've created a set of preference screens building on the tuts on androidguys. My preference XML contains nested PreferenceScreens. The below doesn't occur in the root screen, only once clicking to a child PreferenceScreen. Once in that PreferenceScreen, even before selecting an EditPreference, if I change orientation (i.e. flick the G1 keyboard out) I get an error: 01-30 09:33:54.080: ERROR/WindowManager(1261): android.view.WindowLeaked: that was originally added here.I have previously overcome this in other activities by utilising the onPause etc methods with custom dialogs I use. How can I prevent this in the PreferenceActivity? What am I missing?
View 17 Replies
View Related
Oct 15, 2009
I recently bought a HTC Hero with sprint. i took a picture and tried to send it via text message..i receive error of " Message size limit reached...sorry, you cannot attach this your message" Also, i cannot view a picture message sent to me. i tried also saving it to my 4gb card but cannot find where to view the files in my sd card...
View 19 Replies
View Related
May 7, 2010
I'm having some problems with an error message I'm getting from the Facebook application that came with the phone. The message im getting is "an error has occurred while fetching data [malformedJSon]". This is when I go to new feeds. Anyone else having this issue or know how to resolve it?
View 2 Replies
View Related
Nov 7, 2010
I have a main activity, then i call a new activity intent from this. Lets call this SecondActivity. Then from my secont activity i call a browser intent. Then my browser intent call my second activity's onNewIntent method.Evereything work fine, but when i click on "back" button on my phone on my second activity, i will not going to my main activity, but the browsers activity, why?
View 1 Replies
View Related
Dec 15, 2009
Can we make an application use custom virtual keyboard exclusively? So that no one else can use this virtual keyboard, and our app is always using our keyboard... ?
View 3 Replies
View Related
Sep 11, 2009
I have a service that's running in the background, is there any way (short of keeping a count of onBind() and onUnbind()) to know the number of activities that are bound to it?
I am trying to provide a "quit" function. all my activities derive from the same base class. I am keeping a global static around that says the "quit" button was pressed. then on each of the activities onResume() method, I look for the global static "quit" variable and if it's set to true, I call "finish()" so my activity shuts down, and then next activity on the task stack appears -- which goes through the same process of checking the global static "quit" variable until it gets to the root activity -- which effectively goes back to the main desktop screen.
However, I need a way to reset the global static "quit" variable, otherwise, when I launch the app again, it will check the global static quit variable and shutdown immediately - never coming back up. So, I want to know if there are any activities bound to my service, if not, I would set the global static "quit" variable back to false so that the app could be relaunched again.
View 2 Replies
View Related
Jun 5, 2010
I have an Android Service that I would like to keep running even after the last Activity has been popped off the stack, or the User has chosen to do something else.
Essentially the Service is listening for changes on a remote server, and I would like to generate a Notification if and only if an Activity from the app isn't running(or visible). In other words, I don't want the Notifications to occur while the User is directly interacting with the app.
In the case where the User is directly interacting with the app, the Service will notify the Activity and update appropriate UI elements based on the changes. I plan to implement this through the Observer pattern.
How can the Service know if none of apps Activities are bound to it?
View 2 Replies
View Related
Jan 20, 2010
Trying to replicate the behavior of ItemizedOverlay.boundCenterBottom(), inside of one of my Overlay classes. I am fairly certain that I can do this using setBounds(), but I am utterly lost as to what setBounds() is actually doing.
View 1 Replies
View Related
Mar 23, 2010
I haven't been able to figure out how to change the google account I originally activated my hero with. The reason i want to change it is because my gmail app only opens email from that account, and I used a new gmail account to register my phone with that was specifically for my contacts, and now i cant check my other gmail accounts email. anyone know a good solution without having to format?
View 4 Replies
View Related
Jul 29, 2010
I am new to Android. I am using the SDK 2.2 and when i execute the speech demo app, i get the following error message "Recogniser not found". I have read the previous posts on the same topic, but i could no resolve the same. Can you please provide me some inputs.
View 5 Replies
View Related
Nov 2, 2010
The app runs in the emulator, the apk in the bin directory runs on my phone. But when I export it it will not run on the phone. There is only a message saying that installation failed, no reason nothing. I thought my installation had gone bad so I tried to export one of my other projects but they still worked fine. How can I trace down this error?
View 3 Replies
View Related
May 7, 2009
I uploaded the new updates to the application in the market. There was no error message shown. It seemed that the uploading was successful. However, the version name and the app itself were still the old version. FYI: lost the original private key or the keystore file. I generated a new keystore file to sign the app. I also met the minSDK problem and solved it by set the minSDKversion in the manifest file. There must be a way to update the app. I don't want to upload the app as an new application since there is a large base of existing customers.
View 11 Replies
View Related
Jan 27, 2010
I have a website that I want my android visitors to see. It is created in Joomla 1.5. The problem is that sometimes I get the message "The page contains too many server redirects" on my G1. Does anyone know what this means or how I can fix the problem?
View 1 Replies
View Related
Sep 14, 2010
I justed remove some pre-installed apps from my Wildfire, then when I try adding Widgets to home screen, I see the first widget named as #a5ff0000/HTC. I tap on it, an error shown: The process com.htc.RosieUtility has stopped unexpectedly. Can someone tell me explain me what Rosie Utility is, and which app that it may depend on, or some reason causes it stop.
View 1 Replies
View Related
Jan 12, 2010
want to know is there any architecture wise problem or else?
View 1 Replies
View Related
Oct 3, 2010
I believe I accidentally (as a dumb noob) deleted the TelephonyProvider.apk and the Sprint_Promotion.apk apps. I got them on my SD card and have been trying unsuccessfully to reinstall them all night on package installer but I keep getting this wonderful "process com.android.phone" force close message. I managed to get my phone into airplane mode thinking if I disconnected it from the internet I could stop the error messages and do the installs off my SD card but to no avail. I'm trying to do it through Package Installer.
View 3 Replies
View Related
Mar 22, 2010
I'm starting an activity when a button is pressed, and normally (in other apps) haven't had an issue. But when I press the button in this app, I get an "unable to marshal value" error.Exact(ish) error from LogCat:
03-22 02:49:02.883:
WARN/System.err(252):
java.lang.RuntimeException: Parcel:
unable to marshal value
{CLASSNAME}@44dcf1b8
I feel that this might be related to the extra that I'm passing to the intent. I'm passing an ArrayList as a serializable to this new intent. My concern is that the data structure that the ArrayList contains isn't being serialized (as it's a personal data structure).Is the array list content data structure causing this? Something else that I'm missing?
View 1 Replies
View Related
May 16, 2010
I followed the directions verbatim in this Android tutorial, copying/pasting the code from the site to my app. http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
However, when I try to run in the Android emulator, I get the error: "The application Hello Tab Widget has stopped unexpectedly. Please try again."
I tried debugging by introducing a breakpoint in the first line of the onCreate method, but the error occurs before the breakpoint is even hit. Any idea of what is going wrong, or any other way I can debug this issue? I am using Eclipse.
View 2 Replies
View Related
Jul 26, 2010
Got an error during activity start. code...
View 2 Replies
View Related
Apr 4, 2010
me and my partners are working on developing a pwa client for android Am getting an error while calling an activity from another activity.the error is as follows...
View 3 Replies
View Related
Jul 2, 2010
How to send any message from one activity to another using intent and intent filters?
View 1 Replies
View Related
Jun 1, 2010
I want to write an application to List the Gmail message. In the list, if user click one of the message item, it shall link out Gmail App to see more detail information. Currently I can read the Gmail db with Gmail.java. There are some problems while I want to open Gmail Activity. In general, we can open Activity with Action and parameters. But Gmail App has not release code base. We do not know what Action set to Gmail Activity and what parameter shall we put the extras. I only know that the Activity of View detail Message is named "HtmlConversationActivity." And the Package is under "com.google.android.gm.
View 1 Replies
View Related
Oct 31, 2010
My app's main activity listens to a broadcast message. When it receives the message it brings the activity to the front. I want to update the activity if it is in the front, so the user is playing with it, but otherwise I do not want to bring the activity to the front. How should I do it? Is there a flag for invoking the intent, or what?
View 4 Replies
View Related
Oct 13, 2010
Cannot find a solution which is for email or which works.
View 1 Replies
View Related
Apr 19, 2010
I query the table by using this function below
CODE:...........
I got the error "View Root.handleMessage(Message)line:1704". I could insert the data but can't query the data. I called this function below
CODE:..........
In SQLite, is there any case-sensitive in the name of database, table, column?
View 2 Replies
View Related