Difference between startActivityForResult() and startActivity()?

Aravindh Srinivasan picture Aravindh Srinivasan · Jan 2, 2013 · Viewed 28.5k times · Source

What is the difference between startActivityForResult() and startActivity() ?

When, and for what, should I use each one ?

Answer

Nanne picture Nanne · Jan 2, 2013

startActivity

Start an activity, like you would start an application: for instance: you have an app with a home-screen and a user-info screen: if you press the user-info button, you start the user-info activity with this.

startActivityForResult

Start an activity and expect something in return. For instance, on your user-info screen, you can upload a profile picture. You start the gallery-activity with the explicit goal to get a URI back with the preferred picture. You start this activity literaly to obtain a result (the picture. There are some techinical ways to make sure you actually get the result, but they are quite clear in the manual.