I assume that you are starting another action and you expect the current activity to receive the onStop () callback. According to the life cycle of the activity, the onPause () method is called before onStop (). In some cases, onSaveInstance () is also called before the onStop () method. In addition, when you call startActivity or startActivityForResult (again, I assume that you expect onStop to be called), depending on the parameters passed, if these parameters need to be calculated / extracted / etc, it may take some time before the system will be able to execute startActivity, which would be the earliest that Android initiates lifecycle calls. In the absence of any code, it is impossible to see what else is being executed before calling onStop. I suggest you check the timeline of the code, starting at startActivity and when onStop is called, perhaps by starting timestamps for each call, starting from the timestamp before calling startActivity, ending with the timestamp at the beginning of onStop to find out where the time was spent. I also suggest simplifying this by making sure that all startActivity or startActivityForResult parameters are previously set to their values, if not already.
source share