Wednesday, June 2, 2010

[android-developers] Re: Android finishActivity()

I am a little confused by what you are trying accomplish here.

You are starting ActivityB and not finishing ActivityA.
When you hit the back button you want it to finish ActivityB but NOT
return to ActivityA?

If you didn't want ActivityA anymore, why didn't you finish it?

If you want to keep ActivityA around until ActivityB finishes then
implement an @override onResume method in ActivityA to finish it when
pops back to the top of the activity stack.

-hgb

On Jun 1, 8:29 pm, mike <hasitharand...@gmail.com> wrote:
> hi guys,
>
> i have 2 activities. (Activity A and Activity B).
>
> Main Activity A is the Starting Activity. Activity B will run on top
> of Activity B and is a Blur View.
>
> when i'm redirecting to the Activity B i'm not finishing activity A.
>
> I'm Starting Activity B like this
>
> startActivityForResult(intent, 107);
>
> so when i press back button from Activity B i'm doing this (Simply i
> want to exit from the Application)
>
>         @Override
>         public boolean onKeyDown(int keyCode, KeyEvent event) {
>                 // TODO Auto-generated method stub
>                 if (keyCode == KeyEvent.KEYCODE_BACK) {
>                         finish();
>                         finishActivity(107);
>                         Intent intent = new Intent(this, Menu.class);
>                         startActivity(inten);
>                         return true;
>                 }
>                 return false;
>         }
>
> but when i press back button it displays the Activity A again???????
>
> how can i fix this. once i press back button i want to exit from the
> application.
>
> regards,
> Mike

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