Example of removing yourself from the history stack after forwarding to
another activity. This can be useful, for example, to implement
a confirmation dialog before the user goes on to another activity -- once the
user has confirmed this operation, they should not see the dialog again if they
go back from it.
Note that another way to implement a confirmation dialog would be as
an activity that returns a result to its caller. Either approach can be
useful depending on how it makes sense to structure the application.
Demo
App/Activity/Receive Result
Source files
src/com/google/android/samples/app/Forwarding.java |
Forwards the user to another activity when its button is pressed |
/res/any/layout/forwarding.xml |
Defines contents of the Forwarding screen |
|