I'm thinking that activity B crashes somewhere in onCreate / onStart / onResume, and Android restarts the last known good activity A.

Check the logcat for crash messages.

-- Kostya

14.07.2011 18:46, Jalal пишет:
Dear Android Community,

I'm having a strage problem and have no idea what might be wrong. I
have an option menu in an Activity, let's call it A, in which one of
the options needs to start a new Activity, B, and close A. The problem
is that the caller activity, B, is not closing. Instead Activity B is
launched, closes and goes back to Activity A. Weird!

Here's a sample of my code...

@Override
public boolean onOptionsItemSelected(MenuItem item) {
         switch (item.getItemId()) {
             case x:
                 .......//do something
                break;
             case y:
                ......//do something else
                break;
             case z:
                Intent intent = new Intent(A.this, B.class);
                startActivity(intent);
                this.finish();
                break;
         }
         return true;
}

I have tried moving the order in every way possible and some other
workarounds I have found online, but nothing seems to work. I hope
someone has encountered this problem before or has an idea of what
might be wrong. Thanks in advance.

Cheers,
Jalal


--
Kostya Vasilyev

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

Reply via email to