I’ve got an activity (say activity 1) which sends a bunch of extras to another activity (activity 2). I’d like those extras to be sent to activity 2, but I don’t want that activity to display at all.
I’d like to send the intent to activity 2, and go straight into activity 3.
The reason for this is:
Activity 1: User chooses some options from the UI
–> Activity 2 is sent some of the chosen parameters
–> A service is started which uses the parameters from activity 2
Activity 3 is displayed, which is the next UI for the user.
One approach was to just start activity 2, and have activity 2 start activity 3. This doesn’t work for me though, because even without a content view, activity 2 still tries to display momentarily. Also, if the back button is used from activity 3, then activity 2 shows up. I’d like to never show activity 2. Should activity 2 be a service?
You can prevent an activity from being displayed after pressing BACK by using the flag : look at http://developer.android.com/reference/android/content/Intent.html#FLAG%5FACTIVITY%5FNO%5FHISTORY
You can have your Activity 2 not setContentView() and nothing will be displayed
Why can’t Activity 1 call Activity 3 directly ? Activity 2 needs to add data ? Perhaps you could move all that code to a subclass of your Application object and manage state through that ?