Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
687 views
in Technique[技术] by (71.8m points)

java - Android : activity killed by Android as activity can't gain focus

I have a problem that happens randomly. This problem induces a restart of my app but I don't see any crash in LogCat (no FATAL EXCEPTION).

Here are the steps to produce this bug:

  1. Launch the app (Activity A launched)
  2. Launch Activity B
  3. Launch Activity C
  4. Click back to go back to B (the problem can occur randomly here)
  5. Click back to go back to A (the problem can also occur randomly here)

Here are the 'errors' I see in LogCat:

InputDispatcher: Waiting to send key to Window{7a53648 u0 com.xxx.xxx/com.xxx.xxx.ActivityB} because there are unprocessed events that may cause focus to change

V/WindowManager: Changing focus from Window{7a53648 u0 com.xxx.xxx/com.xxx.xxx.ActivityB} to null displayId=0 Callers=com.android.server.wm.RootWindowContainer.updateFocusedWindowLocked:560 com.android.server.wm.WindowManagerService.updateFocusedWindowLocked:6237 com.android.server.wm.DisplayContent.setFocusedApp:6602 com.android.server.wm.ActivityTaskManagerService.setResumedActivityUncheckLocked:6642 

I think that it is these errors that induce a restart of my app (without any fatal crash in LogCat or fatal error message displayed to the user). I don't think that I have any process pending in the activity closed by a click on the back button (I see in LogCat that I go through onPause and onStop).

Anybody knows what could induce this issue ? How to find the origin of the problem and solve it ?

Thanks


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...