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. Application that refershese imgView with image from internet

Hi!
I'm new to Android programming and I need to make an application that
will download image from internet, and refres it every 2-3 seconds. I
tried with Timer(); but no luck. So far I have managed to download and
show image on button click. I need that on button click I refresh that
image in a time interval.

Hope you aunderstand my problem!

Thanks in advance,
Antonio

-- 

2. Serveral questions regarding bluetooth-stack (Handsfree UUIDs SPP Headset)

Hello Android-developers,

I am quite new to Android development but have several questions about
the bluetooth-implementation in Android.

Goal: I would like to use an Android-equipped mobile phone as a
Handsfree for another mobile phone using the Bluetooth HFP.

I was able to use my laptop running Ubuntu 10.04 as a Handsfree for
several of my mobile phone (Nokia with Symbian and Samsung Galaxy S
with Android 2.1) using the "nohands"-project (http://
nohands.sourceforge.net/). Using the bluez sdptool I was also able to
verify the different bluetooth services offered by each mobile phone
(Headset Audio Gateway, Handsfree Audio Gateway, SPP, Phonebook Access
PSE, A2DP and so on).

Now I took the Android SDK and started with the "BluetoothChat"
example. By uploading it through the USB Debugging mode to my Galaxy S
running Android 2.1 everything works as expected. Nevertheless, I can
not test the chat functionality as I don't have another Android-phone.
bluetooth-channels I indirectly have to look up the channel for a
given service by using "createRfcommSocketToServiceRecord". The
correct UUID for a given profile can be found at
http://www.bluetooth.com/Specification%20Documents/AssignedNumbersServiceDiscovery.pdf.
The correct UUID for connecting to a Handsfree Audio Gateway should be
0000111f-0000-1000-8000-00805F9B34FB. Unfortunately, this does not
work. On the log I can see several "E/BluetoothService.cpp( 2244):
stopDiscoveryNative: D-Bus error in StopDiscovery:
org.bluez.Error.Failed (Invalid discovery session)". Replacing the
UUID with the one for the SPP (00001101-0000-1000-8000-00805F9B34FB)
everything works - the Galaxy bonds to a Nokia and the connection is
established.

By reading the internet I discovered that only the SPP is supported by
Android right now!? This fact surprises me as my Galaxy also offers a
lot more services as stated earlier. Are all these propriertary
enhancements by Samsung? By browsing through the Android code I was
not able to find the "BluetoothService.cpp" from the error log but a
"BluetoothService.java". Unfortunately, there is no point where it
says "only take the SPP UUID and throw an error for all others".
Furthermore, considering the BluetoothChat example it looks like it is
possible to make up own UUIDs which are then in fact accepted!?

I am "a little" lost at this stage! Can somebody tell me if there is
some way to extend the bluetooth-stack of my Samsung-specific Android?
Can I replace the bluez-Stack or one of its components or so with a
version I can improve from the vanilla Android?

Thank you very much!

Best regards,
Robert

-- 

3. What is Gdi and Why Should You Care?

4. How to pass a String from an activity to a service

5. Needs help to understand how usb/android works

6. Android Street View availability check

7. Queries on developing an android SSL socket client program