On Sun, Jul 4, 2010 at 2:51 PM, Jroid <[email protected]> wrote: > I have two activities. The first is a list where the user selects one > of the items which takes them to a second activity showing the details > of the item they selected. When the user clicks the back button I > want the app to return to the first activity. > > Is there anything special i need to do to make this happen?
That usually happens by default. > Right now when I click the back button from the second activity it > exits the app just like the home button would. Then your first activity is gone for some reason (e.g., you called finish()). > Here is how I am starting the Second Activity. > startActivity(new Intent(getApplication(), SecondActivity.class)); > finish(); You called finish(). That means you want the first activity to be destroyed. Replace these two lines with: startActivity(this, SecondActivity.class) and things should work better. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 2.8 Available! -- 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

