top ListActivity destroyed just after a Search has been initiated from it - was: Back key after Search doesn't return to list in 2.0 as it did in all earlier versions

by Jonas Petersson » Mon, 02 Nov 2009 06:20:33 GMT


Sponsored Links
 Hi again,

Hmm, it seems even more strange to me: the onDestroy() method of the top 
ListActivity is actually called very shortly after the search has 
triggered the onCreate()+onResume() methods that creates the second 
level ListActivity (note that this is the actual same class as the top 
one, just producing a different result due to the SEARCH action).
Call Sequence:

top onCreate()
top onResume()
-- I press search and enter some text.
top onPause()
2nd onCreate()
2nd onResume()
top onDestroy()
-- This is before the second ListActivity is even displayed

So obviously, by the time I press back in the 2nd ListActivity, there is 
no top ListActivity to show. So the problem is not the Back key, but 
that some unknown force has destroyed the top activity...

Note: the code is still compiled with android:minSdkVersion="2" and the 
very same package executes as expected on previous versions. So perhaps 
I've always done something incorrectly, but up until now the result was 
what I expected. In some special cases I do in fact explicitly call 
finish() to force this very effect, but that does not happen in this 
situation.

I didn't notice anything explicitly related to this in the release 
notes, but perhaps there is something between the lines that I have not 
yet realized.

                Advice appreciated / Jonas





--



top ListActivity destroyed just after a Search has been initiated from it - was: Back key after Search doesn't return to list in 2.0 as it did in all earlier versions

by Jonas Petersson » Tue, 03 Nov 2009 06:27:44 GMT


 ere we go again,

This time with full source: Just import into eclipse and build. Run with
any 1.6 or earlier device/emulator to get what I consider the expected
result. Run with any 2.0 emulator (or if you are lucky to have a device)
and you will see Toasts signalling that the primary display was
destroyed just when the secondary search screen has popped up.

If this is indeed how it is supposed to work in 2.0, what would be best
practice to make it work as it did in 1.6? (Preferably still built to
work on both pre-2.0 and 2.0+.)

Best / Jonas

Jonas Petersson wrote:

--


Sponsored Links


Other Threads

1. 3d model loading

Are there any good examples of loading a 3d model on Android?

-- 

2. sending sms from emulator to real device connected on the computer

hi ,i am looking for a solution to send sms from emulator to a real
android device  connected to the computer through usb cable .

-- 

3. what exact mean by (Void...) in asyntask?

4. ListView - is it possible to limit the fling speed?

5. Why is my progress bar not visible?

6. Long process before a dialog is opened

7. kernel built error