How should I deal with persisting an Android WebView if my activity gets destroyed while showing ano
Posted
by Shaun Crampton
on Stack Overflow
See other posts from Stack Overflow
or by Shaun Crampton
Published on 2010-03-24T13:33:56Z
Indexed on
2010/03/24
14:03 UTC
Read the original article
Hit count: 284
android
Hi,
I'm building an Android application that's based around an enhanced WebView (based on PhoneGap). I've enhanced the WebView so that from JavaScript running inside you can invoke the native contact picker to choose a phone number (which may be supplied by Facebook for example).
The problem I have is that the native contact picker runs in an activity in another process and the Android docs say that while another activity is open my activity may get destroyed due to memory constraints. I haven't actually seen this happen in my application but if it did then I'm guessing my WebView's state would be destroyed and the code that was waiting for the picked contact would be terminated.
It seems a bit crazy that the activity requesting a contact could be destroyed while the contact picker is open. Does anyone know if that does indeed happen? Is there a way to persist the state of the WebView if it does?
Thanks,
-Shaun
© Stack Overflow or respective owner