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. singleTask + activity stack not preserved?

Hi,

I have an activity, ActivityA, and its launchMode is set to
"singleTask".

I start the application from the app tray. ActivityA launches
ActivityB from a button click. ActivityB is a normal activity with no
launchMode set ("standard").

With ActivityB on top of the activity stack, I hit the home button,
then resume the app, I see ActivityA instead of ActivityB when
resumed.

Shouldn't the history stack be preserved in this case, and B be
showing? When I resume, I see A get onNewIntent() called, and I'm not
sure why this is happening. I thought the stack would be preserved.

Thanks

-- 

2. how many intent in android

how many intent in android? can i get a list of all intents in android? Can
i add new intent to system?

-- 

3. to go from one activity to another via a kind of popup

4. ZuDoKu's TeSt

5. SQlite to Sybase synchronization

6. About how to make new buttons in a row?

7. What is the right way of using SQLite for phone book application?