views:

59

answers:

3

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 activity?

A: 

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)
HappyGeisha
A: 

I would check if the

protected void onDestroy();

is been called,

Andres Yajamin
A: 

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.

vbsteven