You are just guessing, aren't you? How could 'this' resolve to any
other object than to 'YourClassName.this'?

On Jul 14, 8:12 am, Yorath Wang <[email protected]> wrote:
> try to change this.finish() to be YourClassName.this.finish();
>
> On Jul 14, 10:46 pm, Jalal <[email protected]> wrote:
>
> > 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

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