[android-developers] Manually-changed Preference in a PreferenceActivity
I have a PreferenceActivity where one of the preferences, a ListPreference, is assigned a listener for a user-selected change. In the listener's onPreferenceChange method, the user is presented with a dialog (showDialog) to confirm the change, and the onPreferenceChange returns false. If the user responds OK in the presented dialog, some database work is done and then the preference is manually updated with the previously- selected value using a SharedPreferences.Editor. This all works fine, and I've confirmed that the preference is changed and visible from other activities. However, the PreferenceActivity itself doesn't reflect the change in the ListPreference value when the user selects it again. This is a problem. The change does show up as it should until the PreferenceActivity is exited and started again by the user. How do I get the PreferenceActivity to show the changed preference value in this case? It appears to be keeping a cache of previously retrieved preferences, not refreshing it when subsequently selected unless true is returned by onPreferenceChange. -- 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] Debug Certificate Expired
I got a surprise today when I edited the source for a project in Eclipse, for an existing Android app. Here is the console message: [timestamp - project] Error generating final archive: Debug certificate expired on 30/04/10 2:13 PM! Anyone know what's going on here? As a precaution, I've already tried cleaning the project, restarting Eclipse, etc., and I am up to date with Android SDK packages through to 2.1. Thanks. -- 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: Allow only decimal numeric input and use phone soft keyboard?
Try adding the following line to the xml to filter for integer input: android:digits=0123456789 I've had some success using android:inputType to select the soft keyboard and android:digits to filter which keys are accepted. On Apr 21, 5:25 pm, Watter matthewcwe...@gmail.com wrote: I am trying to do something that I thought would be simple, yet I still haven't found the right approach. I have a EditText field that should only accept unsigned decimal entries. Using android:inputType=numberDecimal in my layout xml file achieves this, however the soft keyboard that is raised with this inputType is the standard keyboard but just uses the alternate view with the number row on top. This is far from ideal for a field that only allows numbers. A much better soft keyboard for numeric entry is the phone one. It has all of the numbers and a decimal. Perfect!! Well, except that for the life of me I cannot figure out how to use both the phone keyboard AND allow only numeric entry. I've tried everything I can think of but if I use the phone soft keyboard then the input field also allows things like ( and any of the other symbols available on that keyboard. Is there any way to get the nice big numeric buttons of the phone keyboard along with only allowing decimal entry? -- 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 athttp://groups.google.com/group/android-developers?hl=en -- 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: Forcing the Symbols Soft Keyboard
Thanks, but that does not solve my problem. I specify android:digits because the acceptable characters for the EditText are more than just numerals. From my brief perusal of the IME samples in the SDK (not the actual Android source code), specifying android:digits always brings up the qwerty soft keyboard, which is not what I want. On Apr 5, 4:26 am, Kumar Bibek coomar@gmail.com wrote: For your edit text, use this property. android:inputType=number This will pop up thekeyboardwith numbers only. But in this case you will not be able to enter anything other than numbers. Thanks and Regards, Kumar Bibek On Apr 5, 12:57 am, Nmix nepean...@gmail.com wrote: I have an EditText that specifies android:digits where all the specified characters are on the standard symbols softkeyboard. Unfortunately it seems that just using android:digits is enough to always cause the qwertykeyboardto pop up. Always having to press the 123? key for that one EditText is a bit inconvenient for my users and, sad to say, it's a difficult concept for a few. Apart from writing up a custom IME, is there a way toforcethe symbolskeyboardon an EditText? I did look around and even try a few things, but I'm now thinking this isn't possible. Hopefully I'm wrong. Thanks. -- 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 To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Forcing the Symbols Soft Keyboard
Looks like I spoke too soon. I must not have tried the combination before, but specifying: android:inputType=number android:digits= does exactly what I need. I get the symbols soft keyboard and it is free form input with the characters I specify in android:digits. It isn't what I expected, but it works so I won't complain. On Apr 5, 9:40 am, Nmix nepean...@gmail.com wrote: Thanks, but that does not solve my problem. I specify android:digits because the acceptable characters for the EditText are more than just numerals. From my brief perusal of the IME samples in the SDK (not the actual Android source code), specifying android:digits always brings up the qwerty softkeyboard, which is not what I want. On Apr 5, 4:26 am, Kumar Bibek coomar@gmail.com wrote: For your edit text, use this property. android:inputType=number This will pop up thekeyboardwith numbers only. But in this case you will not be able to enter anything other than numbers. Thanks and Regards, Kumar Bibek On Apr 5, 12:57 am, Nmix nepean...@gmail.com wrote: I have an EditText that specifies android:digits where all the specified characters are on the standard symbols softkeyboard. Unfortunately it seems that just using android:digits is enough to always cause the qwertykeyboardto pop up. Always having to press the 123? key for that one EditText is a bit inconvenient for my users and, sad to say, it's a difficult concept for a few. Apart from writing up a custom IME, is there a way toforcethe symbolskeyboardon an EditText? I did look around and even try a few things, but I'm now thinking this isn't possible. Hopefully I'm wrong. Thanks. -- 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] Forcing the Symbols Soft Keyboard
I have an EditText that specifies android:digits where all the specified characters are on the standard symbols soft keyboard. Unfortunately it seems that just using android:digits is enough to always cause the qwerty keyboard to pop up. Always having to press the 123? key for that one EditText is a bit inconvenient for my users and, sad to say, it's a difficult concept for a few. Apart from writing up a custom IME, is there a way to force the symbols keyboard on an EditText? I did look around and even try a few things, but I'm now thinking this isn't possible. Hopefully I'm wrong. Thanks. -- 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 To unsubscribe, reply using remove me as the subject.
[android-developers] Re: SimpleCursorAdapter SQLite field not found in ListActivity
On Dec 22, 12:38 pm, jcknight jckni...@gmail.com wrote: I have a SimpleCursorAdapter that I’m using to pull the contents of aSQLitetable and populate a ListView. Here is some code: http://pastie.org/private/ibrwbcv1xu1dpv2l7ys5g When it tries to populate the ListView I get an IllegalArgument exception: 12-22 09:03:16.423: ERROR/AndroidRuntime(230): java.lang.IllegalArgumentException: column 'active' does not exist So it's complaining about the column active not existing. However when I connect to the emulator via adb and list the table's schema, I get this: CREATE TABLE backup_schedules ( _id integer primary key autoincrement, name varchar(128) not null, interval integer not null, active integer not null default 1, location integer not null, dayOfWeek varchar(128) default '', day integer not null, hour integer not null, minute integer not null ); Try escaping the quotes in the String literal in your code: dayOfWeek varchar(128) default \'\', -- 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: Error: exception ViewRoot$CalledFromWrongThreadException - How can I solve this?
On Dec 23, 9:23 pm, Martin google-gro...@digle.de wrote: Here is the error I get: Leonard Frog [Android Application] DalvikVM[localhost:8613] Thread [3 main] (Running) Thread [15 Binder Thread #3] (Running) Thread [13 Binder Thread #2] (Running) Thread [11 Binder Thread #1] (Running) Thread [17 Thread-9] (Suspended (exception ViewRoot $CalledFromWrongThreadException)) LeonardFrog.doDraw() line: 78 LeonardFrog.access$2(LeonardFrog) line: 76 LeonardFrog$AnimationLoop.run() line: 151 Thread.run() line: 1058 You must only touch views in the UI (main) thread. -- 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 do I backup my application signing key?
Don't feel too bad, that is bizarre behavior for jarsigner on Vista. The same thing happened to me, so I made some notes to prevent getting surprised should something like that happen again. I don't know if Vista is at fault or if it is some attempt by the JDK to follow a peculiar Windows convention. Regarding the search, you do have to be careful with the search options or it'll miss some folders, including those in the application data branch. I use Vista out of some necessity, but I am not an apologist for Microsoft. On Nov 24, 8:35 pm, skyhigh skyhigh1...@gmail.com wrote: Yes I am using Windows Vista and the keystore was exactly where you said. When I created my keystore file I was in the directory where the keytool.exe is located under c:\Program Files\Java\...\bin and it actually created the keystore file under c:\username\AppData\Local \VirtualStore\Program Files\Java\...\bin. I did use the Windows Vista search function to look for the file and I knew what the file name was, but even though I told it to search the entire C: drive it didn't ever find the file. Looking back it would have been much better to have made a directory where I wanted the keystore file to be saved and then either added the Java bin directory to my path or just entered the path to run the keytool program. However at the time I didn't realize that Vista was going to put the file somewhere else which would be extremely difficult to locate. -- 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 do I backup my application signing key?
Vista? Oh yes, finding the keystore was ... interesting. I'm surprised you simply didn't do a disk search to find it. If you don't want to do that, look in a folder that is something like: C:/username/AppData/Local/Virtual Store/Program Files/Java/jdk1.6_xx/ bin Not very intuitive, but that's what we get for using Vista. And as Mark said, back it up. It's simply a file so copy it somewhere. In my case I've copied that keystore to several places, including sending myself emails (with the keystore as an attachment) to offline mail servers scattered over half the globe. I do the same with source code. That way, anything short of a 2012-scale catastrophe won't hinder me from recovering critical business data. On Nov 18, 10:41 am, skyhigh skyhigh1...@gmail.com wrote: Is the keystore located somewhere that the file can be easily copied to back it up and I am just not able to find it? Is no one replying because this should be obvious and I just can't see how to do it, or because no one knows how to backup the applicationsigningkey. The information that is available on the applicationsigningkey warns that if you lose the key you will not be able to update your application on Android Market any more. Backing up this key seems to be critical. If someone knows how to do this please let me know what I need to do. -- 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] WVGA432 and long/notlong
I set up layout folders as follows: layout layout-long-port layout-long-land layout-notlong-port layout-notlong-land Other than layout each folder has a main.xml file. The layout folder contains layouts that are screen independent. I set up AVDs for WQVGA400 and WQVGA432. From the docs, it looks like both should be long. On the 400 the long layout is applied, but on the 432 the notlong layout is applied. What am I not understanding about this? I want long applied on the 432 screen. -- 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: Since Android 2.0 the phone number in the emulator became null - how to set it?
Yes it is. I can see it in Settings and I can retrieve it with .getLine1Number(). However... if you are using a broadcast receiver for BOOT_COMPLETED, I have found with 2.0 (and sporadically with earlier versions) that it is not available when the receiver runs. Some delay seems to be required before attempting to retrieve the number. I've only tested this on the emulator, not a real phone. On Nov 1, 3:00 pm, Marek Urbaniak marek.urban...@gmail.com wrote: It the earlier versions of Android SDK the emulator had the set phone number. Visible in the phone settings and accessible to applications through the TelephonyManager.getLine1Number method. In Android SDK 2.0 it is not set. How to set it? -- 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: Receiving Missed Call event
The only way I know is to put an observer on the call log: ContentResolver logObs = getContentResolver(); logObs.registerContentObserver (CallLog.Calls.CONTENT_URI, false, new ContentObserver (new Handler()) { public void onChange(boolean selfChange) { super.onChange(selfChange); //query the call log, order descending, and see if first item is a missed call //take care not to count each missed call more than once (could happen) } }); I haven't tested this in 2.0 but hopefully it still works. On Nov 1, 9:35 pm, Marc Lester Tan mail...@gmail.com wrote: Hi folks, anyone have idea how can I make my code receive a Missed Call event? I know I can receive the RINGING state as well as OFFHOOK state via: TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); telephony.listen(phoneListener, PhoneStateListener.LISTEN_CALL_STATE); but what I need to have is to capture the event when the calling party terminated the call. tia, Marc -- 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] Unexpected Resumes Running Under 2.0
I just installed SDK 2.0 and tested a stable app on a 2.0 AVD to make sure it's still ok. It isn't. I'm trying to debug this, but the problem, whatever it is, looks to be happening in Android, not in my app. App starts fine, flowing through the entire onCreate() and initializing everything. I tested this with by attaching the debugger to the emulator and setting breakpoints throughout. Good so far. Then the application resumes, calling the onCreate() again. This continues, presumably forever or until I kill the app. On every iteration I am getting log messages with the tag UsageStats. The messages I'm seeing include: W UsageStats Something wrong here, didn't expect *packagename* to be resumed W UsageStats Unexpected resume of com.android.launcher while already resumed in *packagename* The first of these messages appears for every iteration. The second one appeared only once. The app I'm testing isn't too fancy, but I have had 6-figures worth of user downloads and no one has ever reported a problem like this. Suggestions? --~--~-~--~~~---~--~~ 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: Unexpected Resumes Running Under 2.0
I did some additional testing on the 2.0 AVD, including numerous project cleans, compiling with 1.5, 1.6 and 2.0, and cutting out large swaths of code. The problem persists. Yet other apps I have work fine on 2.0. I peppered logs in each of the major life cycle methods I implement, and this is what I get: 10-29 20:33:23.561: DEBUG/tag(502): onCreate 10-29 20:33:24.271: DEBUG/tag(502): onResume 10-29 20:33:26.101: DEBUG/tag(502): onSaveInstanceState 10-29 20:33:26.214: DEBUG/tag(502): onPause 10-29 20:33:26.311: DEBUG/tag(502): onCreate 10-29 20:33:26.561: DEBUG/tag(502): onRestoreInstanceState 10-29 20:33:26.571: DEBUG/tag(502): onResume 10-29 20:33:27.081: DEBUG/tag(502): onSaveInstanceState 10-29 20:33:27.130: DEBUG/tag(502): onPause 10-29 20:33:27.211: DEBUG/tag(502): onCreate 10-29 20:33:27.601: DEBUG/tag(502): onRestoreInstanceState 10-29 20:33:27.611: DEBUG/tag(502): onResume 10-29 20:33:28.162: DEBUG/tag(502): onSaveInstanceState 10-29 20:33:28.201: DEBUG/tag(502): onPause 10-29 20:33:28.541: DEBUG/tag(502): onCreate 10-29 20:33:28.951: DEBUG/tag(502): onRestoreInstanceState 10-29 20:33:28.960: DEBUG/tag(502): onResume 10-29 20:33:29.631: DEBUG/FatCalc(502): onPause I finally kill it with the back key, though it sometimes takes a few tries because the timing is critical. Elsewhere in the log, I found something in the logs put out by the system process that from their timestamp may be correlated with the uninstall/install process initiated by ADB: 10-29 20:33:14.391: WARN/ResourceType(55): Resources don't contain package for resource number 0x7f06 10-29 20:33:14.461: WARN/ResourceType(55): Resources don't contain package for resource number 0x7f060001 These correspond to string resources in the app, both of which appear to display normally when the app runs, in the momentary glimpses of the app's UI display before it gets destroyed. This really has me puzzled. Any help appreciated. On Oct 29, 12:06 pm, Nmix nepean...@gmail.com wrote: I just installed SDK 2.0 and tested a stable app on a 2.0 AVD to make sure it's still ok. It isn't. I'm trying to debug this, but the problem, whatever it is, looks to be happening in Android, not in my app. App starts fine, flowing through the entire onCreate() and initializing everything. I tested this with by attaching the debugger to the emulator and setting breakpoints throughout. Good so far. Then the application resumes, calling the onCreate() again. This continues, presumably forever or until I kill the app. On every iteration I am getting log messages with the tag UsageStats. The messages I'm seeing include: W UsageStats Something wrong here, didn't expect *packagename* to be resumed W UsageStats Unexpected resume of com.android.launcher while already resumed in *packagename* The first of these messages appears for every iteration. The second one appeared only once. The app I'm testing isn't too fancy, but I have had 6-figures worth of user downloads and no one has ever reported a problem like this. Suggestions? --~--~-~--~~~---~--~~ 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: Unexpected Resumes Running Under 2.0
Apart from a Log.d() that I just added to produce the logcat trace and the super call, there was just one line of code (an 'if' with a condition which isn't satisfied) which is pretty boring. Regardless, I commented that out. No change in behavior. Thanks for the suggestion, Mark, but I am beginning to think that something quite a bit more subtle is going on. Now I'm getting quite worried about when 2.0 shows up in OTA updates because it may/will break my app and I have no idea what to do. Up to 1.6 the app is solid as a rock. On Oct 29, 5:30 pm, Mark Murphy mmur...@commonsware.com wrote: Nmix wrote: I did some additional testing on the 2.0 AVD, including numerous project cleans, compiling with 1.5, 1.6 and 2.0, and cutting out large swaths of code. The problem persists. Yet other apps I have work fine on 2.0. I peppered logs in each of the major life cycle methods I implement, and this is what I get: 10-29 20:33:23.561: DEBUG/tag(502): onCreate 10-29 20:33:24.271: DEBUG/tag(502): onResume 10-29 20:33:26.101: DEBUG/tag(502): onSaveInstanceState 10-29 20:33:26.214: DEBUG/tag(502): onPause 10-29 20:33:26.311: DEBUG/tag(502): onCreate 10-29 20:33:26.561: DEBUG/tag(502): onRestoreInstanceState 10-29 20:33:26.571: DEBUG/tag(502): onResume 10-29 20:33:27.081: DEBUG/tag(502): onSaveInstanceState 10-29 20:33:27.130: DEBUG/tag(502): onPause 10-29 20:33:27.211: DEBUG/tag(502): onCreate 10-29 20:33:27.601: DEBUG/tag(502): onRestoreInstanceState 10-29 20:33:27.611: DEBUG/tag(502): onResume 10-29 20:33:28.162: DEBUG/tag(502): onSaveInstanceState 10-29 20:33:28.201: DEBUG/tag(502): onPause 10-29 20:33:28.541: DEBUG/tag(502): onCreate 10-29 20:33:28.951: DEBUG/tag(502): onRestoreInstanceState 10-29 20:33:28.960: DEBUG/tag(502): onResume 10-29 20:33:29.631: DEBUG/FatCalc(502): onPause I finally kill it with the back key, though it sometimes takes a few tries because the timing is critical. Elsewhere in the log, I found something in the logs put out by the system process that from their timestamp may be correlated with the uninstall/install process initiated by ADB: 10-29 20:33:14.391: WARN/ResourceType(55): Resources don't contain package for resource number 0x7f06 10-29 20:33:14.461: WARN/ResourceType(55): Resources don't contain package for resource number 0x7f060001 These correspond to string resources in the app, both of which appear to display normally when the app runs, in the momentary glimpses of the app's UI display before it gets destroyed. This really has me puzzled. Any help appreciated. Something in your onResume() would appear to be triggering behavior reminiscent of a screen rotation or other configuration change. I'd start by commenting out everything in onResume() and seeing if the problem persists. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Android 1.6 Programming Books:http://commonsware.com/books --~--~-~--~~~---~--~~ 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: Unexpected Resumes Running Under 2.0
Ok, I found it -- it's my bug. Mark, you were partly right, and that helped. It was related to the configuration. Here is the guilty code, which is in onCreate(): mRes = getResources(); mConfig = mRes.getConfiguration(); mConfig.setToDefaults(); //Error here. There should not be a call to setToDefaults(). I don't remember now what I was thinking at the time, and the Android doc is very uninformative for this method. Possibly I copied an example from somewhere. Removing this line solved the problem. Funny thing is that the bad code works fine pre-2.0 releases. However, once I found it I carefully scoured the logcat on a 1.6 AVD and I did find the same warning log spit out from the system process. Of course, since nothing was broken and there was no way to relate the log to my process, I had no idea. I know now because it breaks in 2.0 by forcing a restart of the activity that resembles a config change. I don't know if the 2.0 behavior is right or wrong since the write-up for setToDefaults() says very little. fadden: I did consider filing a bug, but that seemed premature when I wasn't able to localize the problem. I didn't want to simply point to the app on Android Market. Now the point is moot. Thanks. On Oct 29, 7:04 pm, Nmix nepean...@gmail.com wrote: Apart from a Log.d() that I just added to produce the logcat trace and the super call, there was just one line of code (an 'if' with a condition which isn't satisfied) which is pretty boring. Regardless, I commented that out. No change in behavior. Thanks for the suggestion, Mark, but I am beginning to think that something quite a bit more subtle is going on. Now I'm getting quite worried about when 2.0 shows up in OTA updates because it may/will break my app and I have no idea what to do. Up to 1.6 the app is solid as a rock. On Oct 29, 5:30 pm, Mark Murphy mmur...@commonsware.com wrote: Nmix wrote: I did some additional testing on the 2.0 AVD, including numerous project cleans, compiling with 1.5, 1.6 and 2.0, and cutting out large swaths of code. The problem persists. Yet other apps I have work fine on 2.0. I peppered logs in each of the major life cycle methods I implement, and this is what I get: 10-29 20:33:23.561: DEBUG/tag(502): onCreate 10-29 20:33:24.271: DEBUG/tag(502): onResume 10-29 20:33:26.101: DEBUG/tag(502): onSaveInstanceState 10-29 20:33:26.214: DEBUG/tag(502): onPause 10-29 20:33:26.311: DEBUG/tag(502): onCreate 10-29 20:33:26.561: DEBUG/tag(502): onRestoreInstanceState 10-29 20:33:26.571: DEBUG/tag(502): onResume 10-29 20:33:27.081: DEBUG/tag(502): onSaveInstanceState 10-29 20:33:27.130: DEBUG/tag(502): onPause 10-29 20:33:27.211: DEBUG/tag(502): onCreate 10-29 20:33:27.601: DEBUG/tag(502): onRestoreInstanceState 10-29 20:33:27.611: DEBUG/tag(502): onResume 10-29 20:33:28.162: DEBUG/tag(502): onSaveInstanceState 10-29 20:33:28.201: DEBUG/tag(502): onPause 10-29 20:33:28.541: DEBUG/tag(502): onCreate 10-29 20:33:28.951: DEBUG/tag(502): onRestoreInstanceState 10-29 20:33:28.960: DEBUG/tag(502): onResume 10-29 20:33:29.631: DEBUG/FatCalc(502): onPause I finally kill it with the back key, though it sometimes takes a few tries because the timing is critical. Elsewhere in the log, I found something in the logs put out by the system process that from their timestamp may be correlated with the uninstall/install process initiated by ADB: 10-29 20:33:14.391: WARN/ResourceType(55): Resources don't contain package for resource number 0x7f06 10-29 20:33:14.461: WARN/ResourceType(55): Resources don't contain package for resource number 0x7f060001 These correspond to string resources in the app, both of which appear to display normally when the app runs, in the momentary glimpses of the app's UI display before it gets destroyed. This really has me puzzled. Any help appreciated. Something in your onResume() would appear to be triggering behavior reminiscent of a screen rotation or other configuration change. I'd start by commenting out everything in onResume() and seeing if the problem persists. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Android 1.6 Programming Books:http://commonsware.com/books --~--~-~--~~~---~--~~ 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: SimpleCursorAdapter.bindView() and Row Views
Just to close this off (in case anyone cares), there was a bug in my code. However, it was due to the unexpectedness of those multiple calls to bindView() and the changing association of positions and row views. What happened when bindView() was called, I checked the view's tag for a holder object, and if there was one I left it alone. Since, it seems, a row view can be assigned to different positions during the filling of the adapter/ListView. This means I have to update the view holder, or create a new one, with the most current position data in every call to bindView(). I don't understand why it operates this way, but now that I do, I got it working. On Oct 23, 10:36 am, Nmix nepean...@gmail.com wrote: This has actually gotten worse. When I finish the app by pressing the back button, then re-launch the app, I am now also getting row views for position 0 from the previous run of the app. So now I have 3 row views floating around for position 0. Am I doing this all wrong, or what? The key part of this is that when a button is clicked I can easily access the correct row view that contains the button, but I have the problem when I then try to modify a different row view. In my particular case, the problem is only when that other row view is for position 0. On Oct 22, 7:56 pm, Nmix nepean...@gmail.com wrote: I have a problem withbindView() that has me puzzled. I am using it to customize each row, including setting icons, coloring the background and setting up listeners for buttons. It mostly works as expected, but not quite. When I fill the ListView with SimpleCursorAdapter, I get multiple calls tobindView() for position 0, but only 1 call for the other rows. The problem is that when all is said and done, I have 2 rows (LinearLayout) created for position 0. Here is a sample log extract: 10-22 23:25:02.834: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437e13c0 10-22 23:25:02.834: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437e13c0 10-22 23:25:02.844: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437e13c0 10-22 23:25:02.853: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437e13c0 10-22 23:25:02.864: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437e13c0 10-22 23:25:02.934: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437e13c0 10-22 23:25:02.997: DEBUG/PAproto(1042): LBV: pos:1 icon:2 view:android.widget.linearlay...@437e4810 10-22 23:25:03.024: DEBUG/PAproto(1042): LBV: pos:2 icon:3 view:android.widget.linearlay...@437e67a8 10-22 23:25:03.054: DEBUG/PAproto(1042): LBV: pos:3 icon:4 view:android.widget.linearlay...@437e8700 10-22 23:25:03.093: DEBUG/PAproto(1042): LBV: pos:4 icon:5 view:android.widget.linearlay...@437ea660 10-22 23:25:03.234: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437ecf40 10-22 23:25:03.243: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437ecf40 10-22 23:25:03.243: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437ecf40 10-22 23:25:03.254: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437ecf40 10-22 23:25:03.264: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437ecf40 I use a view holder class to hold the view, position and other data so that when a button is clicked, I can retrieve the holder with view.getParent.getTag(). This all works fine. The problem is that there are two views for position 0, but it's the first one in the above logcat that seems to be displayed. My code which acts on the rows when a button is clicked (especially setting background color) does not reliably hit the position 0 row that is actually displayed. I can see what's happening but I am at a loss about what to do about it. Why are two view created for position 0? Is it something that I can control? How? If not, how should I deal with it so that the results when I modify the views are predictable? Thanks! --~--~-~--~~~---~--~~ 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: SimpleCursorAdapter.bindView() and Row Views
On Oct 25, 5:50 pm, Mark Murphy mmur...@commonsware.com wrote: What happened whenbindView() was called, I checked the view's tag for a holder object, and if there was one I left it alone. Since, it seems, a row view can be assigned to different positions during the filling of the adapter/ListView. Absolutely. Otherwise, scrolling through 1,000 items in a list would result in 1,000 rows being created. Understood. It's just that I was surprised that this would happen while the ListView is being initially filled (also, since in this case it's short enough to fit within the screen), and there is no obvious (to me!) reason why a row view would be acted upon this way in this circumstance. This means I have to update the view holder, or create a new one, with the most current position data in every call tobindView(). No, you don't -- you just have to write a view holder that does not track its position. It may depend on how the holder is used, but it's not entirely relevant -- my choice of words above wasn't the best. From within the onClick() for a button on a particular row, I need to find another row and change it. I needed some way to find it. When I still had the problem, I kept track of the view I would eventually alter in a class variable. From there I could pull out the tag and get the data I needed, including the row's position. What finally messed me up is that, when presented with a filled tag in the view presented by bindView(), I *assumed* the position and other data I had put into the holder earlier was still valid. I should have done a cursor.getPosition (), and gone on from there to properly refresh the data within the holder. Because of this mistake, even the logcat output I included earlier was terribly misleading. http://commonsware.com/Android/excerpt.pdfcontains an excerpt from one of my books that demonstrates the technique. I did refer to an earlier tutorial of yours to learn the technique, though not this update. Thanks for making this available! -- Mark Murphy (a Commons Guy)http://commonsware.com Android App Developer Books:http://commonsware.com/books.html --~--~-~--~~~---~--~~ 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: SimpleCursorAdapter.bindView() and Row Views
This has actually gotten worse. When I finish the app by pressing the back button, then re-launch the app, I am now also getting row views for position 0 from the previous run of the app. So now I have 3 row views floating around for position 0. Am I doing this all wrong, or what? The key part of this is that when a button is clicked I can easily access the correct row view that contains the button, but I have the problem when I then try to modify a different row view. In my particular case, the problem is only when that other row view is for position 0. On Oct 22, 7:56 pm, Nmix nepean...@gmail.com wrote: I have a problem withbindView() that has me puzzled. I am using it to customize each row, including setting icons, coloring the background and setting up listeners for buttons. It mostly works as expected, but not quite. When I fill the ListView with SimpleCursorAdapter, I get multiple calls tobindView() for position 0, but only 1 call for the other rows. The problem is that when all is said and done, I have 2 rows (LinearLayout) created for position 0. Here is a sample log extract: 10-22 23:25:02.834: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437e13c0 10-22 23:25:02.834: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437e13c0 10-22 23:25:02.844: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437e13c0 10-22 23:25:02.853: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437e13c0 10-22 23:25:02.864: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437e13c0 10-22 23:25:02.934: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437e13c0 10-22 23:25:02.997: DEBUG/PAproto(1042): LBV: pos:1 icon:2 view:android.widget.linearlay...@437e4810 10-22 23:25:03.024: DEBUG/PAproto(1042): LBV: pos:2 icon:3 view:android.widget.linearlay...@437e67a8 10-22 23:25:03.054: DEBUG/PAproto(1042): LBV: pos:3 icon:4 view:android.widget.linearlay...@437e8700 10-22 23:25:03.093: DEBUG/PAproto(1042): LBV: pos:4 icon:5 view:android.widget.linearlay...@437ea660 10-22 23:25:03.234: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437ecf40 10-22 23:25:03.243: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437ecf40 10-22 23:25:03.243: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437ecf40 10-22 23:25:03.254: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437ecf40 10-22 23:25:03.264: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437ecf40 I use a view holder class to hold the view, position and other data so that when a button is clicked, I can retrieve the holder with view.getParent.getTag(). This all works fine. The problem is that there are two views for position 0, but it's the first one in the above logcat that seems to be displayed. My code which acts on the rows when a button is clicked (especially setting background color) does not reliably hit the position 0 row that is actually displayed. I can see what's happening but I am at a loss about what to do about it. Why are two view created for position 0? Is it something that I can control? How? If not, how should I deal with it so that the results when I modify the views are predictable? Thanks! --~--~-~--~~~---~--~~ 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] SimpleCursorAdapter.bindView() and Row Views
I have a problem with bindView() that has me puzzled. I am using it to customize each row, including setting icons, coloring the background and setting up listeners for buttons. It mostly works as expected, but not quite. When I fill the ListView with SimpleCursorAdapter, I get multiple calls to bindView() for position 0, but only 1 call for the other rows. The problem is that when all is said and done, I have 2 rows (LinearLayout) created for position 0. Here is a sample log extract: 10-22 23:25:02.834: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437e13c0 10-22 23:25:02.834: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437e13c0 10-22 23:25:02.844: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437e13c0 10-22 23:25:02.853: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437e13c0 10-22 23:25:02.864: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437e13c0 10-22 23:25:02.934: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437e13c0 10-22 23:25:02.997: DEBUG/PAproto(1042): LBV: pos:1 icon:2 view:android.widget.linearlay...@437e4810 10-22 23:25:03.024: DEBUG/PAproto(1042): LBV: pos:2 icon:3 view:android.widget.linearlay...@437e67a8 10-22 23:25:03.054: DEBUG/PAproto(1042): LBV: pos:3 icon:4 view:android.widget.linearlay...@437e8700 10-22 23:25:03.093: DEBUG/PAproto(1042): LBV: pos:4 icon:5 view:android.widget.linearlay...@437ea660 10-22 23:25:03.234: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437ecf40 10-22 23:25:03.243: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437ecf40 10-22 23:25:03.243: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437ecf40 10-22 23:25:03.254: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437ecf40 10-22 23:25:03.264: DEBUG/PAproto(1042): LBV: pos:0 icon:1 view:android.widget.linearlay...@437ecf40 I use a view holder class to hold the view, position and other data so that when a button is clicked, I can retrieve the holder with view.getParent.getTag(). This all works fine. The problem is that there are two views for position 0, but it's the first one in the above logcat that seems to be displayed. My code which acts on the rows when a button is clicked (especially setting background color) does not reliably hit the position 0 row that is actually displayed. I can see what's happening but I am at a loss about what to do about it. Why are two view created for position 0? Is it something that I can control? How? If not, how should I deal with it so that the results when I modify the views are predictable? Thanks! --~--~-~--~~~---~--~~ 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: adb logcat Error
Same here with Eclipse and Vista, with the exact same message, but in my case it's for adb install either via Run Configuration in Eclipse or via command line. The install still works, but the activity launch aborts. On Oct 13, 10:18 am, polyclefsoftware dja...@gmail.com wrote: Since upgrading to the v1.6 SDK, I'm getting an intermittent error when trying to launch the logcat from the command line: adb logcat exec '/system/bin/sh' failed: Bad address (14) - It's not that my path variables are not updated properly, because as I say, it works sometimes (about half the time). It's annoying. I'm running in Eclipse with Windows 7. Anyone else experiencing this? --~--~-~--~~~---~--~~ 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: SDK 1.6, ADT 0.9.3, Eclipse 3.4.2: Problem with Android Editors
Solved this problem. It is the same as described in thread: http://groups.google.ca/group/android-developers/browse_thread/thread/f4ba97f99c3b470c?hl=en# as reported by JMichel in this recent thread: http://groups.google.com/group/android-developers/browse_thread/thread/882ade0252db170f?hl=en Reverting to WST 3.0.4 got the Android editors working with ADT 0.9.3. On Sep 28, 12:23 am, Nmix nepean...@gmail.com wrote: I see there were a few replies indicating that I'm not the only one with this problem. Just had some time to play with this, so I tried this: - New install of Eclipse 3.4.2 from the original download - Updated all the Eclipse components to the most recent versions - InstalledADT0.9.3 - Created a new workspace, then imported source from an existing project Still have the same problem. Only difference is the Problems log for the project shows some errors: - Location: Unknown; Type: org.eclipse.core.internal.resources.mar...@17e6fb19 is not of a displayable type - Location: Unknown; Type: org.eclipse.core.internal.resources.mar...@17e6fb1b is not of a displayable type There is a similar warning for the manifest (which I tried to open with the Android Manifest Editor): - Location: AndroidManifest.xml; Type: org.eclipse.core.internal.resources.mar...@408d28b2 is not of a displayable type My temporary workaround is to open the XML-based file with one of the non-ADTsupplied editors. Something is broken, but is it in Eclipse, inADT, or, perhaps more likely, there is some conflict between them. Is anyone on the Android team able to say anything about this??? TIA On Sep 22, 5:29 pm, Nmix nepean...@gmail.com wrote: Pretty much as the subject says. I did the upgrade per instructions, and I can create a1.6AVD and run projects on it. All of that is fine. What I can't do is edit any of the Android XML-based files: manifest, layout and assets. When I try to open any of these, one of the Android Resource/Layout/ Manifest Editors is launched, and fails. I get a Problem Occurred box fromEclipsewith a error: java.lang.NoSuchMethodEditor An error has occurred. See error log for more details. org.eclipse.wst.sse.ui.StructuredTextEditor.isBlockSelectionModeEnabled ()Z Uninstalling and re-installingADTdidn't help. The only relevant error I can see in the log is a warning about a uses-sdk with version (2) is lower than project target API level (4). Any ideas? --~--~-~--~~~---~--~~ 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: SDK 1.6, ADT 0.9.3, Eclipse 3.4.2: Problem with Android Editors
I see there were a few replies indicating that I'm not the only one with this problem. Just had some time to play with this, so I tried this: - New install of Eclipse 3.4.2 from the original download - Updated all the Eclipse components to the most recent versions - Installed ADT 0.9.3 - Created a new workspace, then imported source from an existing project Still have the same problem. Only difference is the Problems log for the project shows some errors: - Location: Unknown; Type: org.eclipse.core.internal.resources.mar...@17e6fb19 is not of a displayable type - Location: Unknown; Type: org.eclipse.core.internal.resources.mar...@17e6fb1b is not of a displayable type There is a similar warning for the manifest (which I tried to open with the Android Manifest Editor): - Location: AndroidManifest.xml; Type: org.eclipse.core.internal.resources.mar...@408d28b2 is not of a displayable type My temporary workaround is to open the XML-based file with one of the non-ADT supplied editors. Something is broken, but is it in Eclipse, in ADT, or, perhaps more likely, there is some conflict between them. Is anyone on the Android team able to say anything about this??? TIA On Sep 22, 5:29 pm, Nmix nepean...@gmail.com wrote: Pretty much as the subject says. I did the upgrade per instructions, and I can create a1.6AVD and run projects on it. All of that is fine. What I can't do is edit any of the Android XML-based files: manifest, layout and assets. When I try to open any of these, one of the Android Resource/Layout/ Manifest Editors is launched, and fails. I get a Problem Occurred box fromEclipsewith a error: java.lang.NoSuchMethodEditor An error has occurred. See error log for more details. org.eclipse.wst.sse.ui.StructuredTextEditor.isBlockSelectionModeEnabled ()Z Uninstalling and re-installing ADT didn't help. The only relevant error I can see in the log is a warning about a uses-sdk with version (2) is lower than project target API level (4). Any ideas? --~--~-~--~~~---~--~~ 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: Emulator won't finish booting...
This has happened to me a few times. When it does, the AVD seems to be permanently broken, or at least I have yet to figure out how to fix it. If you monitor logcat, it always freezes at the following point (assuming it's the same problem you're seeing): ... 07-15 02:13:41.373: INFO/SystemServer(573): Starting System Content Providers. 07-15 02:13:41.384: INFO/ActivityThread(573): Publishing provider settings: com.android.providers.settings.SettingsProvider 07-15 02:13:41.454: INFO/ActivityThread(573): Publishing provider sync: android.content.SyncProvider 07-15 02:13:41.464: INFO/SystemServer(573): Starting Battery Service. 07-15 02:13:41.483: ERROR/BatteryService(573): Could not open '/sys/ class/power_supply/usb/online' 07-15 02:13:41.504: ERROR/BatteryService(573): Could not open '/sys/ class/power_supply/battery/batt_vol' 07-15 02:13:41.514: ERROR/BatteryService(573): Could not open '/sys/ class/power_supply/battery/batt_temp' 07-15 02:13:41.544: INFO/SystemServer(573): Starting Hardware Service. 07-15 02:13:41.554: DEBUG/qemud(546): fdhandler_accept_event: accepting on fd 10 07-15 02:13:41.554: DEBUG/qemud(546): created client 0x10fd8 listening on fd 11 07-15 02:13:41.564: DEBUG/qemud(546): client_fd_receive: attempting registration for service 'hw-control' 07-15 02:13:41.564: DEBUG/qemud(546): client_fd_receive:- received channel id 2 The only solution I've found is to delete the AVD (I used Eclipse to do it), restart Eclipse, create a new AVD, and then run an app that launches the emulator with the new AVD. This is inconvenient if you have lots of app data in the emulator, but it does work. Hopefully this problem is gone in the 1.6 SDK. On Sep 16, 10:16 am, Timothy Collins wookie...@gmail.com wrote: Hmmm - I will try that. My machine isn't exactly the most powerful piece of equipment ever created... But all I am running is Eclipse and the emulator (And, of course, the JDK that underlies Eclipse). And it was working quite nicely before this... I suspect it might be a corrupted data file, but it seems odd to me that it would cause the emulator to hang up like it does - it seems it ought to be one of those It works or it doesn't rather than It works but not completely things... On Wed, Sep 16, 2009 at 10:12 AM, JoaJP joachim.pfeif...@gmail.com wrote: In my experience (all the way from m3), the emulator isn't quite as stable as one would expect... although it's improved considerably. Before you go out and buy new equipment, try to delete the emulator's data image. If the emulator doesn't find it, it creates a fresh one, so all you really lose is database and preferences data. Since 1.5 it's two files, userdata-qemu.img and cache.img They are tucked away somewhere in your home directory, see if you can find .android/avd/avd name.avd (that's the XP directory layout) On Sep 16, 6:43 am, Timothy Collins wookie...@gmail.com wrote: I'll take that under consideration... That might be a very good point. On Wed, Sep 16, 2009 at 9:40 AM, Mark Murphy mmur...@commonsware.com wrote: furby wrote: I actually am starting it using Eclipse... Really, just running the project. (I have to admit, I am rather new at Android development). I created an AVD earlier (While I was attempting to use Netbeans to develop Android apps - it didn't work out very well)... I am just wondering - how can it work one day and then the next day suddenly stop? Depending on the speed of your PC and other things that are going on at the time, the Android emulator may get hung up at the graphical Android logo. I am not aware of a workaround other than to improve system performance, either through hardware (e.g., more RAM) or software (e.g., less stuff running). -- Mark Murphy (a Commons Guy) http://commonsware.com|http://twitter.com/commonsguy Android Training in Germany, 18-22 January 2010: http://bignerdranch.com --~--~-~--~~~---~--~~ 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: Emulator won't finish booting...
Two quick ways to launch the AVD Manager from Eclipse: 1. Click on the AVD Manager icon on the icon bar (it looks sorta like a BlackBerry); or, 2. Select Run - Run Configuration... and click on the AVD Manager... button. From there it should clear how to delete and create AVD's. On Sep 16, 11:26 am, Timothy Collins wookie...@gmail.com wrote: Stupid question (And this really exposes how new I am to Android development so treat me like an imbecile) : How do you delete the AVD and recreate it from Eclipse? (I am somewhat new to Eclipse as well - I have used Aptana for years - which is a derivative of it - but this is the first time I have consistently used Eclipse itself for anything) On Wed, Sep 16, 2009 at 11:22 AM, Nmix nepean...@gmail.com wrote: This has happened to me a few times. When it does, the AVD seems to be permanently broken, or at least I have yet to figure out how to fix it. If you monitor logcat, it always freezes at the following point (assuming it's the same problem you're seeing): ... 07-15 02:13:41.373: INFO/SystemServer(573): Starting System Content Providers. 07-15 02:13:41.384: INFO/ActivityThread(573): Publishing provider settings: com.android.providers.settings.SettingsProvider 07-15 02:13:41.454: INFO/ActivityThread(573): Publishing provider sync: android.content.SyncProvider 07-15 02:13:41.464: INFO/SystemServer(573): Starting Battery Service. 07-15 02:13:41.483: ERROR/BatteryService(573): Could not open '/sys/ class/power_supply/usb/online' 07-15 02:13:41.504: ERROR/BatteryService(573): Could not open '/sys/ class/power_supply/battery/batt_vol' 07-15 02:13:41.514: ERROR/BatteryService(573): Could not open '/sys/ class/power_supply/battery/batt_temp' 07-15 02:13:41.544: INFO/SystemServer(573): Starting Hardware Service. 07-15 02:13:41.554: DEBUG/qemud(546): fdhandler_accept_event: accepting on fd 10 07-15 02:13:41.554: DEBUG/qemud(546): created client 0x10fd8 listening on fd 11 07-15 02:13:41.564: DEBUG/qemud(546): client_fd_receive: attempting registration for service 'hw-control' 07-15 02:13:41.564: DEBUG/qemud(546): client_fd_receive: - received channel id 2 The only solution I've found is to delete the AVD (I used Eclipse to do it), restart Eclipse, create a new AVD, and then run an app that launches the emulator with the new AVD. This is inconvenient if you have lots of app data in the emulator, but it does work. Hopefully this problem is gone in the 1.6 SDK. On Sep 16, 10:16 am, Timothy Collins wookie...@gmail.com wrote: Hmmm - I will try that. My machine isn't exactly the most powerful piece of equipment ever created... But all I am running is Eclipse and the emulator (And, of course, the JDK that underlies Eclipse). And it was working quite nicely before this... I suspect it might be a corrupted data file, but it seems odd to me that it would cause the emulator to hang up like it does - it seems it ought to be one of those It works or it doesn't rather than It works but not completely things... On Wed, Sep 16, 2009 at 10:12 AM, JoaJP joachim.pfeif...@gmail.com wrote: In my experience (all the way from m3), the emulator isn't quite as stable as one would expect... although it's improved considerably. Before you go out and buy new equipment, try to delete the emulator's data image. If the emulator doesn't find it, it creates a fresh one, so all you really lose is database and preferences data. Since 1.5 it's two files, userdata-qemu.img and cache.img They are tucked away somewhere in your home directory, see if you can find .android/avd/avd name.avd (that's the XP directory layout) On Sep 16, 6:43 am, Timothy Collins wookie...@gmail.com wrote: I'll take that under consideration... That might be a very good point. On Wed, Sep 16, 2009 at 9:40 AM, Mark Murphy mmur...@commonsware.com wrote: furby wrote: I actually am starting it using Eclipse... Really, just running the project. (I have to admit, I am rather new at Android development). I created an AVD earlier (While I was attempting to use Netbeans to develop Android apps - it didn't work out very well)... I am just wondering - how can it work one day and then the next day suddenly stop? Depending on the speed of your PC and other things that are going on at the time, the Android emulator may get hung up at the graphical Android logo. I am not aware of a workaround other than to improve system performance, either through hardware (e.g., more RAM) or software (e.g., less stuff running). -- Mark Murphy (a Commons Guy) http://commonsware.com|http://twitter.com/commonsguy Android Training in Germany, 18-22 January 2010: http://bignerdranch.com --~--~-~--~~~---~--~~ You received
[android-developers] Re: Please, some layout help.
It may be you're not re-populating the ListView over configuration changes. Try this: with the list showing properly, press the call button (which should pause your activity), then press the back button to resume your activity. Is the ListView populated? If not, you may have a logic problem, not a layout problem. Make sure the adapter and list are re-filled in your onCreate() code when your activity is paused or destroyed. You may need to save state info somewhere. On Aug 25, 6:17 am, Jiri jiriheitla...@googlemail.com wrote: Hello list, i think i need some help with a layout issue. I have three views, two TextViews (header and footer) and in between a ListView. They are rendered good, in portait mode. When i go into landscape mode, the ViewList is gone. Switching back to portait mode and the ViewList is still goneHere is my xml. ?xml version=1.0 encoding=utf-8? RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android; android:orientation=vertical android:layout_width=fill_parent android:layout_height=wrap_content TextView android:id=@+id/header android:layout_width=fill_parent android:layout_height=wrap_content android:gravity=top android:text=HEADER / LinearLayout android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent android:layout_below=@+id/header android:layout_above=@+id/footer ListView android:id=@+id/ListView01 android:layout_width=wrap_content android:layout_height=fill_parent android:divider=@null android:fadingEdge=none /ListView /LinearLayout TextView android:id=@+id/footer android:layout_alignParentBottom=true android:layout_width=fill_parent android:layout_height=wrap_content android:text=FOOTER / /RelativeLayout Any ideas why this is happening? Thnx Jiri --~--~-~--~~~---~--~~ 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] Color tolerance in a 9-patch border
While fooling around with some custom buttons I made, to save time I manipulated the color of the entire 9-patch image, not just inside the 1-pixel border. Every time this corrupts the 9-patch functionality of the button. What is the tolerance of the color and alpha pixels of that 9-patch border? Does Android look for an exact match to, say, #FF00? I noticed in these cases that when opening the corrupt file, the 9- patch tool briefly flashes the (bad) border pixels, then they change to transparent. It also doesn't add a 1-pixel border to the image as it does for .PNG files that have not yet been converted to 9-patch. This seems to be odd behavior. --~--~-~--~~~---~--~~ 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: I don't receive broadcasts
Your second receiver, TelephoneViewer, does not have the permissions corresponding to the actions you wish to handle. Also, action...MAIN and category...LAUNCHER are not appropriate for a receiver -- try to do the same as you've done in your first receiver. Hopefully this will help. On Aug 10, 10:31 am, Frank von Daak f.vond...@kpage.de wrote: Hello! I have started developing a tool, which should react on an outgoing call or sms and also to be started at boot time. The start at boot time does work properply, but I'm not able to receive the broadcasts for the outgoing calls. Who can tell me, what is wrong with my code?? For this, I added two receivers in my manifest and implemented the broadcast- receivers: manifest.xml: -- receiver android:enabled=true android:name=.BootUpReceiver android:permission=android.permission.RECEIVE_BOOT_COMPLETED intent-filter action android:name=android.intent.action.BOOT_COMPLETED / category android:name=android.intent.category.DEFAULT / /intent-filter /receiver receiver android:name=.TelephoneViewer android:enabled=true android:exported=true android:permission= intent-filter action android:name=android.intent.action.MAIN / category android:name=android.intent.category.LAUNCHER / action android:name=android.provider.Telephony.SMS_RECEIVED / action android:name=android.intent.action.PHONE_STATE / action android:name=android.intent.action.NEW_OUTGOING_CALL / /intent-filter /receiver -- TelephoneViewer.java: -- public class TelephoneViewer extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.d(this.getClass().getSimpleName(), Telephoneviewer.onReceive()); Toast.makeText(context,TelephoneViewer.onReceive(), Toast.LENGTH_SHORT).show();} -- Thank you very much for your support! Best regards, Frank --~--~-~--~~~---~--~~ 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: Launching a Service at the startup
First, I have no desire to be evil. Yet I have an app that must listen for events, and it seems that the only way to hear those events is with a listener in a persistent service that starts up on device boot. The reason is that not all those events have a corresponding broadcast. There are also efficiency and UI issues in that data structures need to be rebuilt every time the service must start to deal with events. A particular example of interest to me is PhoneStateListener, and in particular incoming phone calls. I see no way around having a persistent service at this time, and in fact I need to take some special action to fairly quickly get the service going again should the system kill it. After all, the user downloaded the app and expects it to do what we say it does. Is there a better approach that meets the requirement yet also plays well with resource contention? Will there at least be more broadcasts in future that will complement additional listener events? I know this is asking for a lot, so perhaps being evil for now is in fact the lesser evil. I really do want the app to cooperate with the Android environment. On Jul 23, 3:58 pm, Dianne Hackborn hack...@android.com wrote: Mark answered how to do this, but please: think again about whether you really need to do this. Then think another time. And think once more. And if you are really really absolutely positively sure, this what you want to do, fine, but realize -- On current Android devices, we can keep only a small handful of applications running at the same time. Having your application do this is going to going to take resources from other things that at any particular point in time would be better used elsewhere. And in fact, you can be guaranteed that your service will -not- stay running all of the time, because there is so much other stuff that wants to run (other background services that are only running when needed will be prioritized over yours), or needs more memory for what the user is actually doing (running the web browser on complicated web pages is a great way to kick background stuff out of memory). We have lots of facilities for implementing applications so they don't need to do this, such as alarms, and various broadcasts from events going on in the system. Please please please use them if at all possible. Having a service run forever is pretty close to the side of evil. On Wed, Jul 22, 2009 at 5:43 PM, R Ravichandran ravirajami...@gmail.comwrote: Hello, I have a need to create a background service that starts up during the system boot up, and keeps running until the device is powered down. There is no UI or Activity associated with this. I created a class extending the android Service class, and added the setttings to the AndroidManifest.xml file. When I launch this service in the emulator, I don't see this launched at all. I have overrided almost all the methods in the Service class to put log statements, but none of them shows up. I believe the key is in the console message: [2009-07-22 17:38:59 - MyEventsManager] No Launcher activity found! [2009-07-22 17:38:59 - MyEventsManager] The launch will only sync the application package on the device! I am not sure what to make of this. Here is the AndroidManifest.xml file: ?xml version=1.0 encoding=utf-8? manifest xmlns:android=http://schemas.android.com/apk/res/android; package=com.test android:versionCode=1 android:versionName=1.0 application android:enabled=true android:icon=@drawable/icon android:label=@string/app_name service android:name=.MyEventsManager android:permission=android.permission.RECEIVE_BOOT_COMPLETED intent-filter action android:name=android.intent.action.BOOT_COMPLETED / /intent-filter /service /application uses-sdk android:minSdkVersion=3 / /manifest Here is the console output: [2009-07-22 17:38:59 - MyEventsManager] -- [2009-07-22 17:38:59 - MyEventsManager] Android Launch! [2009-07-22 17:38:59 - MyEventsManager] adb is running normally. [2009-07-22 17:38:59 - MyEventsManager] No Launcher activity found! [2009-07-22 17:38:59 - MyEventsManager] The launch will only sync the application package on the device! [2009-07-22 17:38:59 - MyEventsManager] Performing sync [2009-07-22 17:39:01 - MyEventsManager] New emulator found: emulator-5554 [2009-07-22 17:39:01 - MyEventsManager] Waiting for HOME ('android.process.acore') to be launched... [2009-07-22 17:39:02 - Emulator] 2009-07-22 17:39:02.415 emulator[8874:10b] Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz. [2009-07-22 17:39:21 - MyEventsManager] HOME is up on device 'emulator-5554' [2009-07-22 17:39:21 - MyEventsManager] Uploading
[android-developers] startActivity(intent) and ActivityNotFoundException
According to the doc, if the intent in startActivity(intent) is not found, there will be an exception raised. Therefore I use a try/catch block. However, even if I use a random string as the intent, the promised exception does not occur. Instead I see a dialog that says: No application can perform this function. I also get the same dialog if the intent is valid (picked up by an app) but apparently doesn't want to act when the extras are not what the app expects (e.g. my earlier question about Intent.ACTION_SEND and mime types). I am using the 1.5_r2 SDK on an AVD running 1.5, with the app running at version 1.1 (sdk=2). Is this a doc error, a bug or am I misunderstanding something? Can I simply delete the try/catch block? Thanks. --~--~-~--~~~---~--~~ 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: startActivity(intent) and ActivityNotFoundException
Thanks, Dianne. You're right - I played with it a bit more and now understand it better. Intent i = new Intent(randomstring); startActivity(i); The above does throw the exception as expected. Intent i = new Intent(randomstring); startActivity(Intent.createChooser(i, my title); This does not throw an exception. I get a dialog box with my title as the title and the content is No application can perform this action. (I typed it incorrectly in my original message.) The dialog has no buttons. So it looks as if when I explicitly request the activity chooser, no exception is thrown for startActivity(). That wasn't clear to me. Still seems a bit odd, but maybe that's just me. On Jun 29, 1:35 pm, Dianne Hackborn hack...@android.com wrote: You haven't provided enough information to help. Fwiw, the exception -does- get thrown if there is no activity matching the intent given to startActivity(), and the system does not display such a dialog. So I would assume there is something going on in your app doing this, or you are doing something different from what I am interpreting your description to be. On Mon, Jun 29, 2009 at 8:40 AM, Nmix nepean...@gmail.com wrote: According to the doc, if the intent in startActivity(intent) is not found, there will be an exception raised. Therefore I use a try/catch block. However, even if I use a random string as the intent, the promised exception does not occur. Instead I see a dialog that says: No application can perform this function. I also get the same dialog if the intent is valid (picked up by an app) but apparently doesn't want to act when the extras are not what the app expects (e.g. my earlier question about Intent.ACTION_SEND and mime types). I am using the 1.5_r2 SDK on an AVD running 1.5, with the app running at version 1.1 (sdk=2). Is this a doc error, a bug or am I misunderstanding something? Can I simply delete the try/catch block? Thanks. -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ 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: Intent.ACTION_SEND and Email
That's great. Thanks. Unfortunately this tells me I have to live with what I have since it's beyond my control. I don't mind if other email clients (gmail or whatever) pick up the intent - it's the user's choice - I'd just rather not pick up apps that are not especially suited to my purpose. So it goes. On Jun 26, 10:09 pm, Doug dougforp...@gmail.com wrote: For Email/MMS app: (from packages/apps/Email/AndroidManifest.xml and packages/apps/Mms/ AndroidManifest.xml) data android:mimeType=text/plain / data android:mimeType=image/* / data android:mimeType=video/* / Of course, these are just the mimeType's mentioned in the manifest files distributed as part of the 1.5 source - any additional apps installed on the phone (like the GMail client) will undoubtedly provide their own. And anything could happen in the next release :) Doug On Jun 26, 1:05 pm, Nmix nepean...@gmail.com wrote: I am experimenting with sending email from within my app by launching an email app with startActivity(Intent.ACTION_SEND) or (Intent.createChooser(i, title) with various extras. I have it working, although not completely to my liking. ACTION_SEND is fairly generic so the chooser pulls up email apps and also messaging apps. If there's just the one email app, this means one extra step for the user that would be nice to avoid. Is this possible? Another question is with the mime type set with intent.setType(). The doc on setType suggests text/plain when EXTRA_TEXT is used. This works ok. However when I had first tried setting the mime type to message/rfc822, the chooser failed to find any app that could handle it. (I found this from an example posted by Mark Murphy on Dec 12/08.) This makes me wonder just how I can latch onto the email apps more effectively. Is there a list of mime types that are handled by the Google-supplied messaging apps? Maybe some choice will help me to avoid having the chooser pull up unwanted choices. Thanks. --~--~-~--~~~---~--~~ 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] Intent.ACTION_SEND and Email
I am experimenting with sending email from within my app by launching an email app with startActivity(Intent.ACTION_SEND) or (Intent.createChooser(i, title) with various extras. I have it working, although not completely to my liking. ACTION_SEND is fairly generic so the chooser pulls up email apps and also messaging apps. If there's just the one email app, this means one extra step for the user that would be nice to avoid. Is this possible? Another question is with the mime type set with intent.setType(). The doc on setType suggests text/plain when EXTRA_TEXT is used. This works ok. However when I had first tried setting the mime type to message/rfc822, the chooser failed to find any app that could handle it. (I found this from an example posted by Mark Murphy on Dec 12/08.) This makes me wonder just how I can latch onto the email apps more effectively. Is there a list of mime types that are handled by the Google-supplied messaging apps? Maybe some choice will help me to avoid having the chooser pull up unwanted choices. Thanks. --~--~-~--~~~---~--~~ 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] Installing App From Eclipse to AVD
Just started testing my apps against the 1.5 SDK and got these console messages when I re-install an app to the AVD. Eclipse project is set to 1.1 and the AVD is 1.5: [2009-04-30 22:22:49 - ...] Starting activity com... on device [2009-04-30 22:22:57 - ...] ActivityManager: DDM dispatch reg wait timeout [2009-04-30 22:22:57 - ...] ActivityManager: Can't dispatch DDM chunk 52454151: no handler defined [2009-04-30 22:22:57 - ...] ActivityManager: Can't dispatch DDM chunk 48454c4f: no handler defined [2009-04-30 22:23:04 - ...] ActivityManager: Starting: Intent { ... Apart from these console messages and an extra 30 seconds of delay (for the timeout to occur?), the app does install and run just fine. If there's something I'm doing wrong in the build I would like to know so that I avoid problems down the line. From the 'DDM' it may be related to the debugger, however I am not attempting to use it. I've also noticed that the emulator in this SDK is very sluggish in comparison to previous versions when it comes to switching tasks etc. Thanks. --~--~-~--~~~---~--~~ 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: Dialog Survival Over Configuration Change
My workaround is in the message you quoted. I don't see how overriding onPrepareDialog can work since it isn't called after the config change -- that's the essence of the bug. On Apr 27, 9:02 am, AusR austinjr...@gmail.com wrote: I see bug 1639 - is there a workaround to restore a 're-created'dialogusing code in an overridden onPrepareDialog? On Mar 6, 6:13 am, Romain Guy romain...@google.com wrote: It is a problem. In my, and others', opinion it is a *bug* that the onPrepareDialog is not called when adialogis restored on a configurationchange. onCreateDialog is called when appropriate, but onPrepareDialog is not It is a bug indeed. I think the onPrepareDialog should ALWAYS be called just before a dialogis shown, whether it is through an explicit call to showDialog (x) or through the restoration management of the activity. On Mar 5, 1:32 pm, Nmix nepean...@gmail.com wrote: On Mar 4, 11:59 pm, Nmix nepean...@gmail.com wrote: No doubt you're right. After a while it feels like I'm doing a peculiar dance to celebrate the Rites of Spring, all the while sprinkling magic pixie dust over my code. I had already come to the same conclusion, that doing dismissDialog() in onSaveInstanceState() is a mistake, because it changes activity state in a way such that thedialogdoesn't automatically reappear at the end of a phone call (which it did before). As to what I want to accomplish, it's very simple: all views, including anydialog, survives overconfigurationchanges and temporary ceding of control to another activity. Until I encountered the problem with my dynamic dialogcontent I had everything under control. It was then that I speculated that I ought to just dismiss thedialogin this rare case to simplify my life since thedialogis easily re-accessed by the user with one button press. Ideally I would want to do have thedialog survive, and contain the same (refreshed) dynamic data. So let me see if I've got this right (I can revisit the code later to try stuff). In onSaveInstanceState() I bundle away the stateful data I need to refresh the app state and all views, including dialogs. If the app is just being paused, the saved data shouldn't be used elsewhere, such as in onResume(), where it isn't delivered anyway. And I believe onRestoreInstanceState() will not be called. I am uncertain at this point whether, in case of restoration after config change, I should pull the saved data from the bundle in onCreate () or, (which I image happens afterward) in onRestoreInstanceState(). When I was merely pulling database records and filling in dynamic parts of the main layout view, I don't believe it mattered. With static dialogs, I don't need to do anything at all. With dynamic dialogs I started running into problems and coming up with ineffective solutions. As reported earlier, I can't call dismissDialog() -- it seemed unavailable to my code after restoration of the activity. So if I don't call dismissDialog() before the activity is destroyed I have a visibly brokendialogthat I can't dismiss. The buttons still work fine so the user can close it, but that is absolutely not good. When I tried dismissDialog() in onDestroy (), along the lines that Marco suggested, nothing happened. I haven't checked but I assume onDestroy() was not called. Romain suggested removeDialog(), which I haven't tried yet, though I have to wonder if it'll work after restoration when dismissDialog() does not work. The way things stand, if I don't call dismissDialog() in onSaveInstanceState() I can't get rid of it. Yet if I do I seem to be creating additional trouble for myself since if it was just an ordinary pause I have to redo showDialog() in onResume() for no particularly good reason other than I can't find a better way. Sorry to be so long winded, but I wanted to try and be clear about this. If I hear nothing I will likely try this latter route and see what happens. I'll pull the saved data in onCreate() and then call showDialog() in onResume(). If I manage stateful data appropriately I think this will work. I just hope there's a better way. Thanks for your interest. This worked. However I suspect that there must be a better way to handle managed dialogs, or perhaps there should be. Active dialogs that I can't access or dismiss after activity restoration is a problem.- Hide quoted text - - Show quoted text - -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them
[android-developers] Re: Listview row layout dependent on remote data
What I've done in the past is use a single layout that has all the possible views, which I set visible, invisible or gone depending on context. That should work well with ListView since you can customize the row, including visibility of widgets, in your getView() or bindView () method. On Apr 20, 5:07 pm, AusR austinjr...@gmail.com wrote: Hi, Does anyone have any pointers on developing a listview where the layout of the rows of a listview are dependent on some to-be- downloaded data. For example. the rows will detail a time table, so the downloaded items for each row will be a days worth of classes. But then the row will have multiple TextViews (Clickable) and they will be set as width = duration of class. Therefore the textviews will be of differing number and widths for each row only known after download. I will be using a custom horizontal fling on the listview to scroll to different periods of the day. Thanks for any pointers. --~--~-~--~~~---~--~~ 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: Anything on Android that can do smooth scrolling?
With some trepidation I am wading into this discussion... It seems to me that real-time applications where time is of the essence in providing a good user experience (like action games) need a way to tell the OS how it can protect that experience. One idea that comes to mind is maximum time that it can relinquish the attention of the processor, and the minimum attention it requires over, say, 1 second. Let's pick 50 ms for max relinquishment, although I know that may be too long for some apps, and 95% usage per second, but only if it is not stopped by its own intention. The OS then does its best to honor that requirement by ensuring that all other processes, including those dispatched by Android or the kernel, never use more than 50 ms per second for other stuff (could be multiple slices of 50 ms). I chose the times this way since it focuses the objective on the user and is independent of processor speed, which should improve over time. Other UI-based apps are paused (if I understand correctly) when they are not at the front, and so do not consume any cycles. Events for them queue up (stuff like content observers and timers) until they come to the foreground. It's services and Android itself that are the main concern. Then it becomes a matter of time slice required, and priority of the action. Kernel levels stuff is likely not a concern since high-priority hardware interrupts (or polling) should happen quite quickly. If one of those low-level events wakes up a service, and if it is somehow determined of high enough priority for the service (or OS) to bring a UI activity to the foreground, the UI process in the foreground gets definitely paused. This supports phone calls etc. However there are a couple of questions that come to mind: 1. What is the minimum time slice Android can allocate to processes, on a G1-class processor, without getting bogged down in process- swapping overhead? If it's longer than 50 ms, that's a problem. 2. GC takes quite a bit longer than 50 ms. The process (service in this case) requiring GC seems not to be the problem here, but can GC be carved into smaller time slices? I know nothing about Android's GC but I can imagine that it may require pausing all processes since it is operating on a shared heap and may not be able to allow processes to access the heap for any reason while it is working. Or perhaps defer GC while a real-time app is flying along until there is imminent risk of heap exhaustion. The time slicing methods are well-known, as Dianne mentioned, but what can be achieved may be limited by what GC or other OS-level activities require in an uninterruptable time slice. It may be that GC needs some work. I hope this helps, though I should point out that the last OS's I really tore into at this level of programming were MVS and RSX. Now that's dating myself. On Mar 27, 12:40 pm, Dianne Hackborn hack...@android.com wrote: Okay I have to assume at this point that you two are actually trolling. First, NOBODY has said that it isn't important to be able to do well performing games. The only discussion here is about how to achieve that. (And Al, I don't need some snide little link to a doc on Linux kernel scheduling; I am generally aware of how scheduling in the kernel works, but not deeply involved in the details, because we have other kernel engineers who are and spend extensive amounts of time in the code of the scheduler getting it to work well in our system, and looking at how to modify it to help with the background app situation.) Second, I find it faintly surreal to see these repeated claims that the only way to possibly allow for decent games is to have some only my app can run option, when people have been doing well performing games on Windows for years. Ages ago this was because they could be the only one running, but that hasn't been the case for years. This is basically a well known problem and there are well known solutions. (And now, the prefer foreground apps option is NOT the same; that should be the normal default behavior on Android.) Third, oh just let the foreground app be the only one running opens up a huge can of worms, as has already been pointed out. Clearly it's not the -only- thing running, because you still want to receive phone calls, so the phone app is special... gee for the people complaining about that, I guess we should be glad we don't allow third party apps to replace it! :} Or if we did, or we wanted -anything- else to happen while this game is going, then apps have some facility to declare that they get to override the override, and it just escalates from that. Again, there are well known ways to deal with these issues, and a special this is the only app running (wink wink) mode is not it. On Fri, Mar 27, 2009 at 4:11 AM, Al Sutton a...@funkyandroid.com wrote: What I'm advocating is the Building on the shoulders of giants principal. To start with we get to where everyone else is by
[android-developers] Re: How to find Jarsigner
Just to add to Mark's suggestion, jarsigner is part of JDK but not part of JRE distributions. It may be that you downloaded the wrong package. It can be confusing since JRE includes keytool, but not jarsigner. You want JDK. On Mar 22, 2:46 pm, Mark Murphy mmur...@commonsware.com wrote: Nox wrote: Unfortunately there is noJarsigner!!! Can I find it in an other way? I need it urgent, because I want to publish my app. Thejarsignerprogram is not from Android or the Android SDK. Your Java JDK should have come with it -- if it did not, try downloading and reinstalling the JDK again from Sun. -- Mark Murphy (a Commons Guy)http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Available! --~--~-~--~~~---~--~~ 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: Question on listing an app in Featured Apps list at Android Market?
This seems to be entirely at the discretion of the folks at Android Market. My experience is that they requested info from us (at their initiative) when they decided they *may* feature one of our apps. They do not promise. The reason given for the selection was the app's high ranking within its category. In other words, if your app achieves some level of user acceptance, they may contact you. There may very well be other avenues to get your app featured, but if these exist I am unaware of them. On Mar 13, 4:01 am, Victa victor...@gmail.com wrote: Dear fellow Android developers, My company has an app that we are very confident to make it one of the most useful Android apps, and I would really like to know how to make it to the Featured app list at Android Market. Does anyone have such experiences or knowledge, regarding the process or requirement to make it to the Featured App list? Any information would be greatly appreciated! Best, Victa --~--~-~--~~~---~--~~ 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: Failed to reopen debug port for Selected Client to:
Same thing happened to me this week. A quick search indicates that the ::1 address for localhost is in some way related to IPv6. I don't know why this happens, but then I didn't dig any deeper (I figure the less I know about Vista the happier I'll be). I made the same edit to the hosts file and all is fine again. On Mar 10, 6:27 am, Emmanuel emmanuel.ast...@gmail.com wrote: I had the same problem yesterday ! Actually, the original poster post saved my day : it's the window Host file that is messed up : the file is at this place : C:\WINDOWS\system32\drivers\etc And should contain this line : 127.0.0.1 localhost Putting this line back allow me to debug once again. But to tell the truth, I'm more than worried by this. I can't imagine how this line get removed. To add it back, I had Windows Defender that warned me 'something' was happening. And later, as I was working on my Android application, the line got removed once again. And Windows Defender didn't tell me anything. So I really suspect there is a virus there that remove this line... If someone know something about that, I would be glad to here it ! Emmanuelhttp://androidblogger.blogspot.com/ On 10 mar, 03:45, jus...@ragblue.com wrote: I'm having the exact same problem. It started today. I could always connect before. Can you be more specific about your solution with your host file? Justin On Mar 5, 1:19 pm, NWallman ad...@noobspeak.com wrote: Turns out my hosts file was messed up. When I fixed that my problem was resolved. On Mar 4, 8:02 pm, NWallman ad...@noobspeak.com wrote: Hi, I am struggling to get my emulator to be able tobindfor debugging purposes. I get the following stack trace when I start my emulator: [2009-03-04 19:35:46 -ddms]Failedto reopen debug port for Selected Client to: 8700 [2009-03-04 19:35:46 -ddms]Address family not supported by protocol family:bind java.net.SocketException: Address family not supported by protocol family:bind at sun.nio.ch.Net.bind(Native Method) at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source) at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source) at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source) at com.android.ddmlib.MonitorThread.reopenDebugSelectedPort(Unknown Source) at com.android.ddmlib.MonitorThread.run(Unknown Source) [2009-03-04 20:00:39 -ddms]Can'tbindtolocal8600fordebugger [2009-03-04 20:00:43 -ddms]Can'tbindtolocal8601 fordebugger [2009-03-04 20:00:43 -ddms]Can'tbindtolocal8602 fordebugger [2009-03-04 20:00:45 -ddms]Can'tbindtolocal8603 fordebugger [2009-03-04 20:00:54 -ddms]Can'tbindtolocal8604 fordebugger [2009-03-04 20:00:54 -ddms]Can'tbindtolocal8605 fordebugger [2009-03-04 20:00:54 -ddms]Can'tbindtolocal8607 fordebugger [2009-03-04 20:00:55 -ddms]Can'tbindtolocal8610 fordebugger [2009-03-04 20:00:55 -ddms]Can'tbindtolocal8611 fordebugger Can someone please explain to me what I am doing wrong? Here are some specs: Windows Vista Ultimate JDK 1.6 Update 12 Android SDK 1.0r2 Thanks!- Hide quoted text - - Show quoted text -- Masquer le texte des messages précédents - - Afficher le texte des messages précédents - --~--~-~--~~~---~--~~ 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: Dialog Survival Over Configuration Change
On Mar 4, 11:59 pm, Nmix nepean...@gmail.com wrote: No doubt you're right. After a while it feels like I'm doing a peculiar dance to celebrate the Rites of Spring, all the while sprinkling magic pixie dust over my code. I had already come to the same conclusion, that doing dismissDialog() in onSaveInstanceState() is a mistake, because it changes activity state in a way such that the dialog doesn't automatically reappear at the end of a phone call (which it did before). As to what I want to accomplish, it's very simple: all views, including any dialog, survives over configuration changes and temporary ceding of control to another activity. Until I encountered the problem with my dynamic dialog content I had everything under control. It was then that I speculated that I ought to just dismiss the dialog in this rare case to simplify my life since the dialog is easily re-accessed by the user with one button press. Ideally I would want to do have the dialog survive, and contain the same (refreshed) dynamic data. So let me see if I've got this right (I can revisit the code later to try stuff). In onSaveInstanceState() I bundle away the stateful data I need to refresh the app state and all views, including dialogs. If the app is just being paused, the saved data shouldn't be used elsewhere, such as in onResume(), where it isn't delivered anyway. And I believe onRestoreInstanceState() will not be called. I am uncertain at this point whether, in case of restoration after config change, I should pull the saved data from the bundle in onCreate () or, (which I image happens afterward) in onRestoreInstanceState(). When I was merely pulling database records and filling in dynamic parts of the main layout view, I don't believe it mattered. With static dialogs, I don't need to do anything at all. With dynamic dialogs I started running into problems and coming up with ineffective solutions. As reported earlier, I can't call dismissDialog() -- it seemed unavailable to my code after restoration of the activity. So if I don't call dismissDialog() before the activity is destroyed I have a visibly broken dialog that I can't dismiss. The buttons still work fine so the user can close it, but that is absolutely not good. When I tried dismissDialog() in onDestroy (), along the lines that Marco suggested, nothing happened. I haven't checked but I assume onDestroy() was not called. Romain suggested removeDialog(), which I haven't tried yet, though I have to wonder if it'll work after restoration when dismissDialog() does not work. The way things stand, if I don't call dismissDialog() in onSaveInstanceState() I can't get rid of it. Yet if I do I seem to be creating additional trouble for myself since if it was just an ordinary pause I have to redo showDialog() in onResume() for no particularly good reason other than I can't find a better way. Sorry to be so long winded, but I wanted to try and be clear about this. If I hear nothing I will likely try this latter route and see what happens. I'll pull the saved data in onCreate() and then call showDialog() in onResume(). If I manage stateful data appropriately I think this will work. I just hope there's a better way. Thanks for your interest. This worked. However I suspect that there must be a better way to handle managed dialogs, or perhaps there should be. Active dialogs that I can't access or dismiss after activity restoration is a problem. --~--~-~--~~~---~--~~ 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: Dialog Survival Over Configuration Change
I'm leaning towards agreeing with you, but it may be a toss up between being a bug or obscure documentation, or that I'm just not understanding the situation well enough. If it is a bug, it may be more fundamental than onPrepareDialog() since it doesn't seem as if the old dialog is reachable after restoration. On Mar 5, 5:31 pm, Streets Of Boston flyingdutc...@gmail.com wrote: Good to hear you got it working. It is a problem. In my, and others', opinion it is a *bug* that the onPrepareDialog is not called when a dialog is restored on a configuration change. onCreateDialog is called when appropriate, but onPrepareDialog is not I think the onPrepareDialog should ALWAYS be called just before a dialog is shown, whether it is through an explicit call to showDialog (x) or through the restoration management of the activity. On Mar 5, 1:32 pm, Nmix nepean...@gmail.com wrote: On Mar 4, 11:59 pm, Nmix nepean...@gmail.com wrote: No doubt you're right. After a while it feels like I'm doing a peculiar dance to celebrate the Rites of Spring, all the while sprinkling magic pixie dust over my code. I had already come to the same conclusion, that doing dismissDialog() in onSaveInstanceState() is a mistake, because it changes activity state in a way such that the dialog doesn't automatically reappear at the end of a phone call (which it did before). As to what I want to accomplish, it's very simple: all views, including any dialog, survives over configuration changes and temporary ceding of control to another activity. Until I encountered the problem with my dynamic dialog content I had everything under control. It was then that I speculated that I ought to just dismiss the dialog in this rare case to simplify my life since the dialog is easily re-accessed by the user with one button press. Ideally I would want to do have the dialog survive, and contain the same (refreshed) dynamic data. So let me see if I've got this right (I can revisit the code later to try stuff). In onSaveInstanceState() I bundle away the stateful data I need to refresh the app state and all views, including dialogs. If the app is just being paused, the saved data shouldn't be used elsewhere, such as in onResume(), where it isn't delivered anyway. And I believe onRestoreInstanceState() will not be called. I am uncertain at this point whether, in case of restoration after config change, I should pull the saved data from the bundle in onCreate () or, (which I image happens afterward) in onRestoreInstanceState(). When I was merely pulling database records and filling in dynamic parts of the main layout view, I don't believe it mattered. With static dialogs, I don't need to do anything at all. With dynamic dialogs I started running into problems and coming up with ineffective solutions. As reported earlier, I can't call dismissDialog() -- it seemed unavailable to my code after restoration of the activity. So if I don't call dismissDialog() before the activity is destroyed I have a visibly broken dialog that I can't dismiss. The buttons still work fine so the user can close it, but that is absolutely not good. When I tried dismissDialog() in onDestroy (), along the lines that Marco suggested, nothing happened. I haven't checked but I assume onDestroy() was not called. Romain suggested removeDialog(), which I haven't tried yet, though I have to wonder if it'll work after restoration when dismissDialog() does not work. The way things stand, if I don't call dismissDialog() in onSaveInstanceState() I can't get rid of it. Yet if I do I seem to be creating additional trouble for myself since if it was just an ordinary pause I have to redo showDialog() in onResume() for no particularly good reason other than I can't find a better way. Sorry to be so long winded, but I wanted to try and be clear about this. If I hear nothing I will likely try this latter route and see what happens. I'll pull the saved data in onCreate() and then call showDialog() in onResume(). If I manage stateful data appropriately I think this will work. I just hope there's a better way. Thanks for your interest. This worked. However I suspect that there must be a better way to handle managed dialogs, or perhaps there should be. Active dialogs that I can't access or dismiss after activity restoration is a problem.- 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] Dialog Survival Over Configuration Change
Flipping between landscape and portrait is causing me a problem with dialogs that are active at the time of config change. The dialogs survive (which I think is good), but I have the problem that some of my dialogs contain dynamic content which would need to be refreshed in the dialog views. All that content disappears from the dialog views after the config change. I thought it would be easier to do a dismissDialog() on restoration in onCreate(), letting the user press the button that shows the dialog. I successfully save and recover the dialog id, but when I attempt to dismissDialog(id) I get an IllegalArgumentException: no dialog with id 1 was ever shown via Activity$showDialog. Ok, so that doesn't work, and I still have that messed up dialog up on the screen that I want to get rid of. How can I do that? Are there any other reasonable alternatives? Thanks. --~--~-~--~~~---~--~~ 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: Dialog Survival Over Configuration Change
Ugh. I already use onCreateDialog() and onPrepareDialog() since that is how I deal with making the content dynamic. I figured dismissing it (ok, I agree that's not quite a best practice), would be simplest, especially since in the context of the app it is very unlikely that the user would change config while it is showing. I'll try dismissing in onDestroy(). I hadn't done that since I wasn't sure that it'd be called on a config change. It also seems from your comment that onCreateDialog() and onPrepareDialog() do get called again sometime after onCreate(). If true, I hadn't realized that. I may look into that later and see if I can refresh those dialogs. Thanks. On Mar 4, 11:42 am, Romain Guy romain...@google.com wrote: If you want to call dismissDialog(int) you need to use managed dialogs. You will need to look at the javadoc for showDialog(int), onCreateDialog() and onPrepareDialog(). The API Demos also show how to use managed dialogs. If you are already using these APIs, onCreate() is not the right placae to dismiss the dialog since it doesn't exist yet. You would have to do this in onDestroy() for instance. Note that dismissing the dialog on configuration change goes against the purpose of managed dialogs :) On Wed, Mar 4, 2009 at 8:37 AM, Nmix nepean...@gmail.com wrote: Flipping between landscape and portrait is causing me a problem with dialogs that are active at the time of config change. The dialogs survive (which I think is good), but I have the problem that some of my dialogs contain dynamic content which would need to be refreshed in the dialog views. All that content disappears from the dialog views after the config change. I thought it would be easier to do a dismissDialog() on restoration in onCreate(), letting the user press the button that shows the dialog. I successfully save and recover the dialog id, but when I attempt to dismissDialog(id) I get an IllegalArgumentException: no dialog with id 1 was ever shown via Activity$showDialog. Ok, so that doesn't work, and I still have that messed up dialog up on the screen that I want to get rid of. How can I do that? Are there any other reasonable alternatives? Thanks. -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ 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: Dialog Survival Over Configuration Change
On Mar 4, 12:21 pm, Marco Nelissen marc...@android.com wrote: On Wed, Mar 4, 2009 at 9:13 AM, Nmix nepean...@gmail.com wrote: Ugh. I already use onCreateDialog() and onPrepareDialog() since that is how I deal with making the content dynamic. I figured dismissing it (ok, I agree that's not quite a best practice), would be simplest, especially since in the context of the app it is very unlikely that the user would change config while it is showing. Why do you say that? Opening or closing the keyboard counts as a configuration change, so it's something that can happen at any time. I wasn't speaking in general, but rather the particulars of my app at the time that a specific dialog is shown. It is certainly possible the keyboard would be opened/closed, but it far more likely the user would instead close the dialog. It's a matter of probabilities in a specific circumstance. Dealing with every low-runner use case is not always a good use of time. Provided of course that we avoid force closes --~--~-~--~~~---~--~~ 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: Dialog Survival Over Configuration Change
It's even worse than what you're speaking of, now that I've been doing more testing. onSaveInstanceState() is called for activity pauses (like an incoming call) and also for configuration changes. However it now matters which occurred, it seems, when it comes time to recover. If it was a pause, you have to use onResume(), which you are doing in your example. If it was a configuration change I need the savedInstanceState in either onCreate() or onRestoreInstanceState(), which isn't provided in onResume(). This wouldn't be so bad since the dialogs survive a pause/resume cycle, *except* that I call dismissDialog() from onSaveInstanceState (). Now my earlier solution doesn't work unless I call showDialog() from onResume(), provided that I restore the data in onCreate() but do nothing more. I haven't tried this yet, but I will need to fix something to get it working in all these use cases. Painful. On Mar 4, 5:37 pm, Streets Of Boston flyingdutc...@gmail.com wrote: Made a copy-paste error. The 'dirty' workaround in the onResume() should read: if (mPrepareDialog) { onPrepareDialog(R.layout.mydialogid, mDialog); } On Mar 4, 5:33 pm, Streets Of Boston flyingdutc...@gmail.com wrote: I had a similar issue. There seems to be an issue with onPrepareDialog after a configuration change. In my app i'm using managed dialogs as well. the onCreateDialog creates it and the onPrepareDialog makes sure that the dynamic content is shown correctly. However, when a configuration change happens (keyboard open/close), the onPrepareDialog is never called, just like you mentioned! This is a big problem.http://groups.google.com/group/android-developers/browse_thread/threa... I made a work-around for it by coding this in my Activity: @Override protected void onPrepareDialog(int id, Dialog dialog) { switch (id) { case R.layout.mydialogid: mDialogPrepared = true; ... ... break; default: break; } super.onPrepareDialog(id, dialog); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(mPrepareDialog, (mDialog != null mDialog.isShowing())); } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); mPrepareDialog = !mDialogPrepared savedInstanceState.getBoolean(mPrepareDetailView); } @Override protected void onResume() { super.onResume(); ... ... if (mPrepareDialog) { onPrepareDialog(R.layout.album_details, mAlbumDetailsDlg); } } Again, this is a very dirty trick, but the only way i could get it to work. On Mar 4, 1:53 pm, Nmix nepean...@gmail.com wrote: Just to finish this off, here is what I've learned now that I have it working properly. First, dismissDialog() in onDestroy() does not dismiss the dialog. I have to do it in onSaveInstanceState(). If I do it in onDestroy() and I try to recreate it in onCreate() with showDialog() -- after recreating the dynamic data it needs -- I get two dialog windows: one that's broken (empty dynamic data) and one that's good. Second, if I do nothing at all, onPrepareDialog() is not called on the active dialog after the config change. So simply recreating the data it needs does nothing. I just displays the empty dialog. It all works perfectly when I do a dismissDialog() in onSaveInstanceState(), save the dialog id in the bundle, pull it back out in onCreate(), then create the data and call showDialog(). I suppose it all makes some sort of sense although I do wish it were more intuitive (and simpler). Romain, Marco, thanks for the feedback. On Mar 4, 12:13 pm, Nmix nepean...@gmail.com wrote: Ugh. I already use onCreateDialog() and onPrepareDialog() since that is how I deal with making the content dynamic. I figured dismissing it (ok, I agree that's not quite a best practice), would be simplest, especially since in the context of the app it is very unlikely that the user would change config while it is showing. I'll try dismissing in onDestroy(). I hadn't done that since I wasn't sure that it'd be called on a config change. It also seems from your comment that onCreateDialog() and onPrepareDialog() do get called again sometime after onCreate(). If true, I hadn't realized that. I may look into that later and see if I can refresh those dialogs. Thanks. On Mar 4, 11:42 am, Romain Guy romain...@google.com wrote: If you want to call dismissDialog(int) you need to use managed dialogs. You will need to look at the javadoc for showDialog(int), onCreateDialog
[android-developers] Re: Dialog Survival Over Configuration Change
No doubt you're right. After a while it feels like I'm doing a peculiar dance to celebrate the Rites of Spring, all the while sprinkling magic pixie dust over my code. I had already come to the same conclusion, that doing dismissDialog() in onSaveInstanceState() is a mistake, because it changes activity state in a way such that the dialog doesn't automatically reappear at the end of a phone call (which it did before). As to what I want to accomplish, it's very simple: all views, including any dialog, survives over configuration changes and temporary ceding of control to another activity. Until I encountered the problem with my dynamic dialog content I had everything under control. It was then that I speculated that I ought to just dismiss the dialog in this rare case to simplify my life since the dialog is easily re-accessed by the user with one button press. Ideally I would want to do have the dialog survive, and contain the same (refreshed) dynamic data. So let me see if I've got this right (I can revisit the code later to try stuff). In onSaveInstanceState() I bundle away the stateful data I need to refresh the app state and all views, including dialogs. If the app is just being paused, the saved data shouldn't be used elsewhere, such as in onResume(), where it isn't delivered anyway. And I believe onRestoreInstanceState() will not be called. I am uncertain at this point whether, in case of restoration after config change, I should pull the saved data from the bundle in onCreate () or, (which I image happens afterward) in onRestoreInstanceState(). When I was merely pulling database records and filling in dynamic parts of the main layout view, I don't believe it mattered. With static dialogs, I don't need to do anything at all. With dynamic dialogs I started running into problems and coming up with ineffective solutions. As reported earlier, I can't call dismissDialog() -- it seemed unavailable to my code after restoration of the activity. So if I don't call dismissDialog() before the activity is destroyed I have a visibly broken dialog that I can't dismiss. The buttons still work fine so the user can close it, but that is absolutely not good. When I tried dismissDialog() in onDestroy (), along the lines that Marco suggested, nothing happened. I haven't checked but I assume onDestroy() was not called. Romain suggested removeDialog(), which I haven't tried yet, though I have to wonder if it'll work after restoration when dismissDialog() does not work. The way things stand, if I don't call dismissDialog() in onSaveInstanceState() I can't get rid of it. Yet if I do I seem to be creating additional trouble for myself since if it was just an ordinary pause I have to redo showDialog() in onResume() for no particularly good reason other than I can't find a better way. Sorry to be so long winded, but I wanted to try and be clear about this. If I hear nothing I will likely try this latter route and see what happens. I'll pull the saved data in onCreate() and then call showDialog() in onResume(). If I manage stateful data appropriately I think this will work. I just hope there's a better way. Thanks for your interest. On Mar 4, 9:23 pm, Dianne Hackborn hack...@android.com wrote: I think you are getting yourself into a more and more tangled mess. As a fairly broad rule, you shouldn't be doing any state-changing behavior in onSaveInstanceState() -- this is not for the system to tell you about something interesting happening, but for it to get your current state at whatever point it thinks it might need it. Could we back up and look at exactly what you are trying to do? In which situations do you want the dialog to stay, and in which do you want it to disappear? This shouldn't be in terms of when state is saved or when it is destroyed, but when the user flips the lid / changes the configuration, when the user presses home, when the user switches to another activity, etc. On Wed, Mar 4, 2009 at 5:28 PM, Nmix nepean...@gmail.com wrote: It's even worse than what you're speaking of, now that I've been doing more testing. onSaveInstanceState() is called for activity pauses (like an incoming call) and also for configuration changes. However it now matters which occurred, it seems, when it comes time to recover. If it was a pause, you have to use onResume(), which you are doing in your example. If it was a configuration change I need the savedInstanceState in either onCreate() or onRestoreInstanceState(), which isn't provided in onResume(). This wouldn't be so bad since the dialogs survive a pause/resume cycle, *except* that I call dismissDialog() from onSaveInstanceState (). Now my earlier solution doesn't work unless I call showDialog() from onResume(), provided that I restore the data in onCreate() but do nothing more. I haven't tried this yet, but I will need to fix something to get it working in all these use cases. Painful. On Mar 4, 5:37 pm
[android-developers] Re: Persistent Service and Screen Rotations
Thanks, Dianne. I don't have onConfigurationChanged() implemented in the activity or service, and so far as I know it was only the service that was running, and it has no UI of course. The log says that the onCreate() method on the launchable (but never launched) activity called setContentView(). This failed to find R.layout.main, which I confirmed by checking the resource id in the R.java file. There is currently no layout-land folder. I will eventually add the landscape layouts so this isn't a killer issue. It's that the structure of an app with multiple activities and services is still a bit obscure to me. So I am left wondering how that onCreate() got called. In the manifest the UI activity has the basic stuff like .LAUNCHER specified, and nothing more. Until this happened it had always behaved properly. I would post the manifest but it's on a computer I can't get to right now. On Feb 17, 12:02 am, Dianne Hackborn hack...@android.com wrote: Well if something in a process crashes, yes the entire process goes down. As for the rotation, I don't have a clear enough picture of your app to answer. All I can say is that when you rotate the screen, any running services get onConfigurationChanged() and activities by default get destroyed and re-created when they need to run in a new configuration. On Mon, Feb 16, 2009 at 8:29 PM, Nmix nepean...@gmail.com wrote: When I rotated the screen on the emulator (^F11) to test an app's layout I got a surprise. A different app I am working on crashed. This other app had never been launched since booting the emulator but it does have a service that starts on boot_completed, and which was sitting there quietly in the background doing nothing. The reason for the crash, from the log, is that it couldn't find the layout resource for one of the app's launchable activities that does have a UI. That isn't surprising since I haven't yet provided a landscape layout for for that UI activity. But I had not launched it. Then when I went looking for the service component, I found that it had quit as well. Is this normal behavior? Why did the onCreate of the UI activity get called when it had never been launched? And, does this sort of crash always take out everything running in the same process, including services? Thanks! -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ 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] Persistent Service and Screen Rotations
When I rotated the screen on the emulator (^F11) to test an app's layout I got a surprise. A different app I am working on crashed. This other app had never been launched since booting the emulator but it does have a service that starts on boot_completed, and which was sitting there quietly in the background doing nothing. The reason for the crash, from the log, is that it couldn't find the layout resource for one of the app's launchable activities that does have a UI. That isn't surprising since I haven't yet provided a landscape layout for for that UI activity. But I had not launched it. Then when I went looking for the service component, I found that it had quit as well. Is this normal behavior? Why did the onCreate of the UI activity get called when it had never been launched? And, does this sort of crash always take out everything running in the same process, including services? Thanks! --~--~-~--~~~---~--~~ 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] Using bindView to Customize ListView
In all the examples I've found to manipulate each view in a ListView, the method always seems to be getView(). But these were never Adapters backed by a cursor. I decided to try bindView() within a SimpleCursorAdapter, and so far it works very nicely, especially with the cursor all set up for my use. My question is, is this usage good practice, and could I run into a problem in future? My question may be dumb but I just couldn't find a good example code snippet that uses a cursor. --~--~-~--~~~---~--~~ 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] String Resource - name continue
I created a new string in the resource file and got what seems to be an odd error. The name of the string was continue. The error reported: ERROR invalid symbol: 'continue' Changing the name by even one character solved the problem so it's nothing serious. My question: is there some set of names we must not use as resource identifiers? Thanks. --~--~-~--~~~---~--~~ 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: Eclipse problem with new projects
I created a new Eclipse workspace and that seems to work fine. So now it looks like the old one is corrupt. I suppose I can go through the tedium of moving over all my Android projects to the fresh workspace, but does anyone have any idea how to fix an Eclipse workspace with this problem? On Jan 19, 1:44 pm, Nmix nepean...@gmail.com wrote: For some unknown reason when I now try to create a new Android project in Eclipse (Ganymede running on Windows) it fails to link to the android.jar in the SDK (1.0_r1). This has never happened before, and all my existing projects continue to resolve Android components just fine. Error: Cannot create linked resource '/.org.eclipse.jdt.core.external.folders/.link0'. The parent resource is not accessible. Any idea what's happening? --~--~-~--~~~---~--~~ 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: Problem with simpleCursorAdapter, ListView backed by a managed cursor
On Jan 21, 7:45 am, Mark Murphy mmur...@commonsware.com wrote: Nmix wrote: In a TabActivity I have a tab with a ListView. I manage the visibility of a View for when the list is empty, done after filling the list, whenever I know the backing data changes. When the list is empty (empty View is visible) and the activity is paused, and while paused the backing SQLlite table gets filled, when my activity resumes the ListView gets filled with the new database rows (managed cursor requery?) but I haven't had the chance to set the visibility of the empty View, so it's still there. I can figure out how to do this with some persistent data from pause to resume, but I'm wondering if there's a 'cleaner' and automatic way of achieving this in Android. Thanks. If the trigger for making your View be visible is the existence of data, perhaps notify-on-change support is what you want. I haven't played with this much myself. -- Mark Murphy (a Commons Guy)http://commonsware.com Android Training in Sweden --http://www.sotrium.com/training.php I kept it simple for now and refilled the ListView at onResume, so I avoid having to expose the cursor or other data more globally than I already do. It's somewhat redundant but it works since the visibility logic is inside the method that does the filling. An example that's very similar is Android's Call Log. If it's empty and you make a call, then go back to the log and switch tabs from the dialer to the log, it displays as expected (suppressing the 'empty' View). Maybe they refill whenever the tab is selected. I avoid this since it would be redundant if the data is the same. The difference between my app and the Call Log is that no change of tab is involved. Your suggestion may be better but in the interest of time I will move on with what works. --~--~-~--~~~---~--~~ 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 simpleCursorAdapter, ListView backed by a managed cursor
In a TabActivity I have a tab with a ListView. I manage the visibility of a View for when the list is empty, done after filling the list, whenever I know the backing data changes. When the list is empty (empty View is visible) and the activity is paused, and while paused the backing SQLlite table gets filled, when my activity resumes the ListView gets filled with the new database rows (managed cursor requery?) but I haven't had the chance to set the visibility of the empty View, so it's still there. I can figure out how to do this with some persistent data from pause to resume, but I'm wondering if there's a 'cleaner' and automatic way of achieving this in Android. Thanks. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---