0

I have a button that should change the activity when it is tapped. It does so, but if it is double-tapped instead, the app closes and returns to the app picker screen. When I reopen the app, it appears to have performed the button press, because the other activity is open.

The output that I'm getting after the double tap is:

D/EGL_emulation: eglMakeCurrent: 0xe8404120: ver 3 1 (tinfo 0xe8403710)
W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@9636f2c
D/EGL_emulation: eglMakeCurrent: 0xe8404120: ver 3 1 (tinfo 0xe8403710)
D/OpenGLRenderer: endAllActiveAnimators on 0xe5939f80 (RippleDrawable) with handle 0xdf318510

I have done a bunch of debugging, while simultaneously learning about activity lifecycles and such, but the latest stuff I've done is below...

I took everything out of the onCreate() of the new activity besides these two lines, and it did the same thing.

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);

Then, I tried removing the setContentView line as well, and it was significantly harder to double click fast enough to make it "crash".

This is the code that should launch the activity when the button is pressed:

//Disable interval and start buttons to prevent multiple activities from loading
Button i = (Button) view;
Button s = findViewById(R.id.startButton);
i.setEnabled(false);
s.setEnabled(false);

try {
    Intent settingsActivityIntent = new Intent(this, SettingsActivity.class);
    startActivity(settingsActivityIntent);
} catch(Error error) {
    Log.println(Log.DEBUG,"debug", "*****************************");
    Log.println(Log.DEBUG,"debug",error.toString());
}

I'll appreciate any ideas regarding why this could happen. Thank you!

  • 2
    "The output that I'm getting after the double tap is" -- none of that is a [stack trace](https://stackoverflow.com/questions/3988788/what-is-a-stack-trace-and-how-can-i-use-it-to-debug-my-application-errors). This means that you are looking in the wrong portion of Logcat. For example, in Android Studio, the second drop-down from the left is the process selector. There may be multiple processes associated with your app after the crash, one of which has "[DEAD]" in the name. That will be the crashed process, and the stack trace will appear there. – CommonsWare Mar 14 '20 at 19:14
  • Thanks, I've been avoiding Logcat because it never displayed anything for me, but now that I switched it off of "Firebase", some stack traces could be useful haha. I'm still not getting a stack trace though; I think this is because the app isn't really crashing. It's just popping the activity off the stack or something. I was also getting a "W/ViewRootImpl[MainActivity]: Cancelling event due to no window focus". I've been putting time into learning MotionEvents etc. to see if I that's the critical problem, but no luck so far. – Zachary Jefferies Mar 15 '20 at 18:46
  • Did you find what was the issue? got similar issues myself – Dennis Anderson Dec 16 '20 at 16:07
  • @DennisAnderson No, sorry. I haven't had much time to work on that project, so I just swept it under the table...let me know if you find a solution! I'll post an update if I get anywhere with it. – Zachary Jefferies Dec 17 '20 at 19:52

0 Answers0