0
  1. I have Activity with some data displayed in WebView that I load with WebView#loadDataWithBaseURL
  2. Then I have/click menu option that fires android.content.Intent.ACTION_SEND
  3. Choose email from the chooser
  4. Google email comes up (as expected)
  5. Discard email and hit back button
  6. Action with WebView tries to resume
  7. Bang - I get NullPonterException at line 4380 in WebView.java if (mWebViewCore.getSettings().getNeedInitialFocus()) since mWebViewCore is now null

The only place in code where mWebViewCore is nullified is at WebView#destroy - how do I recover from this? Do I need to recreate the browser and load my data all over again, that seems pretty wasteful? I really appreciate good suggestion at this point

Bostone
  • 36,858
  • 39
  • 167
  • 227

1 Answers1

0

Well, I can tell you that I just tested using a WebView with loadDataWithBaseURL(), where the page I loaded had a link. Clicking on the link brings up the Browser application, as expected. BACK button-ing out of the Browser brings back my app with the WebView just fine, no exceptions.

So, either ACTION_SEND/Gmail are somehow special, or there is something more going on with your app.

Can you replicate the problem in a small project that you can post somewhere?

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • I also have a feeling that it happens with gmail only. I tried facebook and twitroid and it works fine, but coming back from gmail just kills me. I'll put this into standalone project and try – Bostone Nov 11 '09 at 16:45
  • BTW - I did the scenario you described many times with no problem. This is specific to ACTION_SEND and GMail - I'm pretty sure about that – Bostone Nov 11 '09 at 16:46
  • If true, that's pretty wild, and suggests a bug in Android somewhere. If you can come up with a reproducible scenario, post the symptoms and code over on http://b.android.com. JBQ is doing a yeoman's job of keeping tabs on new issues. – CommonsWare Nov 11 '09 at 18:23
  • 1
    Nevermind... Entirely my fault. Actually - shining example of over-engineering where I was unnecessarily using service callbacks and had to monkey with situation where my partially build WebView would be abandoned (user clicks "Back" button) and I had to do WebView#destroy there which what was killing me in the scenario above. I'm back to simple handlers and it works fine – Bostone Nov 11 '09 at 23:20