Why is android restarting my activity when I call finish() on it?
I have an activity that after some user interaction calls finish() on itself. From time to time it gets into a loop where when it calls finish() it finishes but immediately restarts again.
Any idea why android tries to restart my activit开发者_JAVA百科y?
This article might be of help: http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle
Have you tried using this instead?: Force finish another activity that you had previously started with startActivityForResult(Intent, int).
finishActivity(int requestCode)
I would check if the
protected void onDestroy();
is been called,
This was a /facepalm error on my side. I had some logic in onPause where in some cases it would restart the activity. Hence the loop.
精彩评论