Tuesday, August 23, 2011

[android-developers] Activity remains in focus for some time after calling finish()

Hi,

I am stuck here. I have an activity (say Activity 1) with a button. On
click of the button I am starting a new activity (say Activity 2 )and
then calling finish(). But what I see is, before starting Activity2,
Activity1 remains in the focus for a while (5-7 secs approximately)
and then it desappears and Activity 2 comes up. Why is this delay ?

From log, i see onPause() is called immediately after the button click
but there is significant delay in the call onStop.
Also, this delay is seen only when app is launched from the home
screen and it works fine if launched from the main menu.

Code snippet: Activity1

public void onClick(View v) {
// do some stuff
startActivity(intent); // start Activity2
finish();
}

Note: Activity1 and Activity2 are in the different packages and
singleTask.

Any help is really appreciated.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment