[android-developers] Why is the activity being destroyed/recreated (NOT a configuration change)?
Sometimes we are seeing the following behaviour: - Activity A is launched - Activity A starts Activity B - Activity B is used for a while, it can be a few minutes or a few hours - Activity B finishes - Activity A is then destroyed and recreated Why is Activity A being destroyed and recreated, instead of just being restarted (call to onRestart(), onStart(), onResume())? I could understand it if ActivityA had been destroyed some time ago, but what we see from the logs is that AFTER ActivityB.onPause() gets called, ActivityA.onDestroy() is called and then a new instance of ActivityA is created. This isn't due to an device orientation change, as the manifest for both activities contains android:screenOrientation=nosensor and we can't reproduce the behaviour by changing the device orientation. The problem isn't reproducible, but we get logs from users where we can see this behaviour, so we know it is happening. Anyone have an idea why this is happening? This doesn't happen all the time, just occasionally. The usual behaviour is the expected behaviour (ActivityA just gets resumed). Thanks, -DWass -- 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 to force soft keyboard to be visible?
Hello James, Thanks for the code snippet. I've actually tried this. What device did you test this on? My biggest problem is that when I find a combination that works on the G1, it doesn't work on the G2 (HTC Hero) or vice-versa. I'm expecting a nightmare when we have 12 devices out there instead of just 2. -DWass On Sep 25, 7:14 am, James W jpbwebs...@gmail.com wrote: Dwass, dont know if this helps, but I finally got it to work reliably for my particular needs. I have a dialog with a single edit, and I wanted to softkeyboard to automaticallyshowwhen the dialog was opened, and be closed when the dialog was closed. In other words, identical behaviour to the EditTextPreference when used in a PreferenceScreen. In my OnCreate() I have: InputMethodManager imm = (InputMethodManager) SingleEditDialog.this.getContext().getSystemService (Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput (InputMethodManager.SHOW_FORCED,InputMethodManager.HIDE_IMPLICIT_ONLY); Which shows thekeyboardwhen the dialog is opened. Like you, I had trouble getting the thing to hide when I close the dialog, I tried calling toggleSoftInput again but no amount of changing the settings seems to work. It is not entirely clear what is going on here, and I am not sure why there is not a .HIDE_FORCED option. It is my app, why can't I control when thekeyboardis shown? In the end, as I only had one edit field, I was able to use another method to hide it, imm.hideSoftInputFromWindow(singleedittext.getWindowToken(), 0); where singleedittext is my EditText view. Incidentally, there doesn't appear to be a corresponding showSoftInputForWindow() call, though, which is again odd. Anyway, it now works perfectly. Hope this helps someone else! --~--~-~--~~~---~--~~ 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 to force soft keyboard to be visible?
I don't think it is possible that this is not an interesting question, based on the amount of activity in this and other similar posts about how to hide or show the sofkeyboard programatically. I've tested a lot of this behaviour on G1 and G2 (Hero) and the behaviour is either very buggy or there are a lot of subtle dependencies on other settings that either aren't documented or aren't intuitively obvious. Let's hope that the experts can ring in with some comments soon. -DWass On Sep 23, 8:51 pm, Mike Collins mike.d.coll...@gmail.com wrote: Should I take the lack of reply as not an interesting question, no idea or we're checking/thinking? I would like to have some ammunition when I go up against my QA people to explain this uncontrolled behavior. tia, mike --~--~-~--~~~---~--~~ 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 to force soft keyboard to be visible?
Hi Dianne, You say that the G1 has a keyboard and so the IME is not shown by default. I don't understand that statement. Yes, the G1 has a keyboard, but it isn't always OPEN. Especially if the device is in portrait mode, the keyboard is probably NEVER open. The device should be smart enough so that it opens the keyboard if there is no keyboard open. Either that, or we need a way to show the keyboard when we want to (and hide it again when we don't). My current problem is this: When I start an activity, the first EditText field in the layout is focused automatically, but the soft keyboard is not automatically shown. The user must either click (with trackball) or touch the field to open the soft keyboard. IMHO the developer should be able to say that he wants the keyboard shown at this point. Any suggestions? I've tried all the force show keyboard suggestions and they sometimes do work, but usually you get stuck with the keyboard being shown after you leave the field and this causes more problems that it solves. Thanks, -DWass On Sep 19, 8:42 am, Dianne Hackborn hack...@android.com wrote: The G1 has akeyboard, so it works as I said -- the IME is not shown by default. This is a policy decision of the platform. On a myTouch, since it doesn't have akeyboard, the IME will be shown by default in various cases (for example when you enter the edit contacts screen) when the app has indicated that is desired with the input options. -- Dianne Hackborn Android framework engineer --~--~-~--~~~---~--~~ 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] Dynamically changing the content (data) of spinner when opened/closed
Basically I want to be able to tell the difference between the user selected something and the user hasn't selected something yet. I have a static list of items that I want to display in the spinner when it is opened. However, when the user is shown the spinner for the first time (before he opens it), I want the spinner to show “Please select…”. Once the user has opened the spinner I don’t want the “Please select…” item to be shown in the list of possible items. Obviously if the user dismisses the dialog without selecting something I’d like to put the “Please select…” back on the (closed) spinner display. I think I should be able to do this by dynamically adding/removing items from the adapter, but my problem is that I cannot seem to catch the “open spinner” event so that I can do it at the right time. OnClickListener is not supported for spinners. Any ideas what event I can get a callback for when the spinner is opened, so that I can dynamically “fix” the data before the spinner tries to display 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 -~--~~~~--~~--~--~---