1

Android USB debugger on Eclipse stops when switching to an browser intent and navigate for a while.

I'm developing a search/list/detail app.
In detail can jump to an browserIntent:

Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(browserIntent);

Then my app is running in the background, but after a while, the debugger on eclipse disconnects & application on eclipse get terminated. On devices view on eclipse my process disappear.

I've found this on main LogCat:

04-17 10:49:51.392: I/ActivityManager(31744): Process com.lma (pid 31482) has died.
04-17 10:49:51.422: I/WindowManager(31744): WIN DEATH: Window{41635c58 com.lma/com.lma.activity.LoginActivity paused=false}
04-17 10:49:51.492: I/WindowManager(31744): WIN DEATH: Window{419acac8 com.lma/com.lma.activity.search.EventSearchActivity paused=false}
04-17 10:49:51.522: I/WindowManager(31744): WIN DEATH: Window{419b9c38 com.lma/com.lma.activity.search.EventDetailActivity paused=false}
04-17 10:49:51.772: E/Sensors(31744): sensors_poll_context_t::pollEvents, line 202: receive event #### i=2, nb=0
04-17 10:49:52.302: E/dalvikvm(19811): GC_CONCURRENT freed 2213K, 36% free 12109K/18659K, paused 9ms+5ms

When I go back on the phone, my application detail appairs, but display no data at all (cause a private obj in the Fragment has become null). On devices view on eclipse my process has appear again, but not connected to debugger. And I can see this log:

04-17 10:59:37.312: I/ActivityManager(31744): Start proc com.lma for activity com.lma/.activity.search.EventDetailActivity: pid=600 uid=10081 gids={3003}
...
04-17 10:59:40.702: I/ActivityManager(31744): Displayed com.lma/.activity.search.EventDetailActivity: +3s425ms

Then if I go back again to list activity, all static data has been destroyed and application crash due to NullPointerException.

How can I save some data just before my app is destroyed? (I'm using app.getSharedPreferences())

surfealokesea
  • 4,971
  • 4
  • 28
  • 38

1 Answers1

0

Finally I've implemented in each activity onPause() saving data via app.getSharedPreferences(), because onDestroy() event for Application only works for emulator environment.

surfealokesea
  • 4,971
  • 4
  • 28
  • 38