Re: [android-developers] Re: service dies without calling onDestroy()
On Tuesday, December 15, 2009 11:52:32 PM UTC+1, Dianne Hackborn wrote: I'm surprised by that. When *does* onDestroy get called? Because the kernel is killing the process to meet its memory demands. Giving the process a chance to stop this would prevent the system from being able to avoid bad paging states. As far as I have been able to see, onDestroy() is only called when the service is removed from the DVM, never when the DVM itself is about to be terminated. Is this really a good design strategy? I have a service I'd like to behave like this: working, sleeping working, sleeping working, sleeping onDestroy, saving state, terminates. But with no reliable way of detecting a forthcoming termination (e.g. onDestory(), addShutDownHook(), finalize()), I instead have to implement: working, saving, sleeping working, saving, sleeping working, saving, sleeping terminated The only purpose of my service between work, is to keep the state, and it may happily be terminated, given I can save the state before it dies. The solution above I'm instead forced to implement, is quite expensive due to the fact the work/sleep cycle may vary from seconds to hours. I don't like to exercise the flash each tenth seconds, just in case (I have no clue how long the next sleep will be). Have I missed anything, or is this really the way it's supposed to be? My case above can hardly be unique. :-) Best regards, Mikael Kuisma -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: service dies without calling onDestroy()
On Thursday, August 11, 2011 10:25:01 PM UTC+2, Mark Murphy (a Commons Guy) wrote: Please don't write services that way. Use AlarmManager and an IntentService, so the sleeping does not need your service (and process) tying up RAM. Of course I'm using AlarmManager. I'm talking about the DVM abstraction level, not activity/service level. More accurately, it should be: working, saving, shutting down, terminated working, saving, shutting down, terminated working, saving, shutting down, terminated working, saving, shutting down, terminated System.exit()? Since Android keeps the DVM around even after I terminate my services and activities, I thought it would be a nice place to store the state via a singelton object to save flash writes. Then your service should not be in memory to keep the state. You are wasting RAM and harming the user. Services like yours are why there are task killers, the Running Services portion of Settings, etc. Not services like mine, no. Since finalize() wasn't called in the singelton, I tried by using the smallest possible service to catch the onDestroy() to preserve the state. It is not to waste RAM, since Android anyway keeps the objects in the DVM even with every activity and service therein terminated. Why not make use the windfall? Users don't like sloppy developers who keep services in RAM for no good reason. Guess what? Users win. A good reason is to save unnecessary flash writes, wouldn't you say? (I have no clue how long the next sleep will be). You have to know how long the next sleep will be, by definition. After all, you have to tell Android when to resume operation of your code, regardless of how you accomplish it (AlarmManager, Thread.sleep(), postDelayed(), etc.). I don't control the user, I'm sorry. The question remains, why not onDestroy(), a shutdownhook and/or finalize() before killing of the DVM? -- Mikael Kuisma -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Problem with ListView, getting selection to stick first time and when scrolling
Hi, I have a ListView that I can't get to behave as I like. When I click it the first time the item I click won't get selected? It fires the onItemClick event but it is not selected on the screen. If I click the list one more time the selection remains. I want this to be the behavior the first time I click the list as well. How do I do this? Also I would like the ListView to have a item selected by default, and I want the selected item to show as selected when scrolling the ListView. Can this be done? I've tried setSelection(0) and almost everything else I can think of but I can't get this to work. :-/ Oh one more thing that I can't figure out. When scrolling the ListView the background gets darker, how do I change this or turn it off? Any help is appreciated. /Micke -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Acer Liquid on Ubuntu
Thanks but I tried to follow these indications too but still nothing recognized... Mikael On Dec 11, 8:16 pm, Andrei gml...@gmail.com wrote: look at the bottom ofhttp://developer.android.com/guide/developing/device.html On Dec 11, 11:12 am, Mikael mikael.rous...@gmail.com wrote: Hi, I'm having problems getting adb recognize myacerliquid. I tried modifying ~/.android/adb_usb.ini by adding the line 0x0502 and restarted the adb server but still nothing. Anyone being more lucky? Thanks, Mikael -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Acer Liquid on Ubuntu
Hi, I'm having problems getting adb recognize my acer liquid. I tried modifying ~/.android/adb_usb.ini by adding the line 0x0502 and restarted the adb server but still nothing. Anyone being more lucky? Thanks, Mikael -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: ADT Plugin for Exlipse installation fails
Hi, I had the same problem and I've solved it by reading this quote : http://www.mail-archive.com/android-developers@googlegroups.com/msg69804.html Go to Help/Install New Software... Add http://download.eclipse.org/releases/galileo/ to the update sites list (strange it's not installed by default on ubuntu) From there, install WST (use the filter box to find the package) Restart eclipse Go back to Help/Install New Software... and install the Android ADT as explained on the android website. -- Vineus (thanks Vineus) I hope it can help you, Regards On 6 déc, 05:53, Stefano stefano.me...@gmail.com wrote: I just resucitated an old laptop, wiped out the old corrupted XP, installed Ubuntu 9.1, installed Eclipse 3.5.1, installed the sun-java6- jdk from the Synaptic Manager, then I tried to install the ADT as described inhttp://developer.android.com/sdk/eclipse-adt.html, but the installation fails with the following message: Cannot complete the install because one or more required items could not be found. Software being installed: Android Development Tools 0.9.5.v200911191123-20404 (com.android.ide.eclipse.adt.feature.group 0.9.5.v200911191123-20404) Missing requirement: Android Development Tools 0.9.5.v200911191123-20404 (com.android.ide.eclipse.adt.feature.group 0.9.5.v200911191123-20404) requires 'org.eclipse.wst.xml.ui 0.0.0' but it could not be found I found another similar message without solution. Anybody out there can help me getting started? Thanks, Stefano -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How does Android decide if an Activity should be restarted after the Activity crashes?
Hello, It's been almost a week since I posted this question, and it seems that it's still not accepted (or denied)? Is this normal waiting time for an issue to be considered by the moderators? I'm sorry if that is the case, just wondering... Best regards, Mikael Sollenborn Hello, we are developing an application where we are depending on a native, custom-written library which sometimes crashes. When the Activity crashes (it's the Activity's SurfaceView that crashes, either while resuming or pausing Activity) we would like to automatically restart the Activity that was just running, preferably without seeing the idle screen in between. What we find strange is that sometimes, our Activity is restarted by Android automatically after the crash, and sometimes not. How does Android decide this? Is it somehow dependant on exactly what the Activity was doing at the time of the crash and if that was considered important enough to restart? How can we force a restart to make sure the Activity doesn't quit after a crash? Some notes: Running on device flashed with Android 1.5. The Activity is running as singleInstance. Doesn't seem to make much difference which mode it is though. Other methods we have tried are: 1) Since we can predict when crash is going to happen(but not stop it), use AlamrManager to start the Activity again via an Intent, 3 seconds later. Has the disadvantages that 1) need to be able to predict crash 2) if crash takes longer than 3 seconds (normally about 2s) it won't work 3) Idle screen is seen for about ~1 s, since some slack is needed. 2) Start a Service, then let the Service (which always seems to be restarted by Android after crashing) start the Activity in its onStart method. Has the disadvantage that Android doesn't restart the service until 5 seconds after the crash, so the idle screen is seen quite along time before Activity restarts. Is it possible to modify how long it takes before the Service is restarted by the Android system? Any help would be greatly appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to use and create a ColorStateList object???
Hi, I'm trying to set a get a ColorStateList object from a xml file and setting it to a TextView textColor but I can't get it to work. Code: ColorStateList csl = null; XmlResourceParser xpp=Resources.getSystem().getXml (R.color.selector_txt); try { csl = ColorStateList.createFromXml(getResources(), xpp); } catch (XmlPullParserException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } final TextView tv = (TextView) findViewById(R.id.label); tv.setTextColor(csl); in res/color/sector_txt.xml selector xmlns:android=http://schemas.android.com/apk/res/android; item android:state_pressed=true android:textColor=#FF004F79/ item android:state_pressed=false android:textColor=#FF19AEFF/ /selector The TextVew comes from my layout xml of a ListView Im using it in. When I use the above code my app crashes. How to I use the ColorStateList? Have I set it correctly? Where do I find the different states I can use in the xml? thanks /Micke --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: ListView, how do I change the orange highlight color?
Hi Thanks for the reply, but: 1. Thats not the answer I was looking for :-P 2. I'd really like to figure this out without buying a book On Oct 15, 9:06 am, vorcigernix vorciger...@gmail.com wrote: 1) Do not change default colors :) As user, I am used to some color scheming, and all I need to know is that I am hovering or selecting something. It is not an aesthetic race..on appstore I saw application in which I was searching for ok button for 2 minutes. It wasn't there..author decided it is better to have peel page control. 2) If you really need to: there is great article about customizing listviews athttp://commonsware.com/ On 14 říj, 23:51, Mikael Bertlin mikael.bert...@gmail.com wrote: How do I change the original orange highlight color to something else? That is, the color I get when I click in a ListView. I've tried to set the android:textColorHighlight of the ListView and/or the TextView for the rows, nothing work. I've manage to remove it by setting android:listSelector=# of my ListView but I just want to change the color, but it seems impossible. How do I do that? Thanks /Micke- 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] ListView, how do I change the orange highlight color?
How do I change the original orange highlight color to something else? That is, the color I get when I click in a ListView. I've tried to set the android:textColorHighlight of the ListView and/or the TextView for the rows, nothing work. I've manage to remove it by setting android:listSelector=# of my ListView but I just want to change the color, but it seems impossible. How do I do that? Thanks /Micke --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---