I have Main activity with ListView.
Clicking on a list item starts activity B with a button.
Clicking on a button starts an activity C with a list view.
Clicking on a list item starts activity D with readonly text view.
All good so far.
I click Back many times to get back to the main activity.
Then, out of nowhere, activity C's createBundle is called by some class Instrumentation.callActivityOnCreate(Activity,Bundle), and this causes activity C to show up.
I tried using startActivityForResult and onActivityResult to see if it would make a difference. Nope. Still happens.
I also happens if I subsitite activity C with a simple text view activity called Z. Z gets shown after I back up to the main activity.
Anyone ever see this?
Why is a deep sub activity being cal开发者_StackOverflowled when the topmost activity is reached (which doesn't call this activity) ?
I figured it out by setting breakpoints everywhere.
My Activity B has a button, which is used to launch activity C.
Instead of an ONClickListener, I put on OnTouchListener on the button.
When I click on the button, the on touch listener invoked activity C . This is fine.
However, from activity D, if I press BACK many times to get to the main activity menu... something is sending a touch event to the button of activity B (even though I am on the main activity) , and this causes a call to activity C.
Not intuitive to notice at all... for a newbie.
I hope this helps someone.
精彩评论