FileDocCategorySizeDatePackage
Forwarding.javaAPI DocAndroid 1.5 API2884Wed May 06 22:41:08 BST 2009com.example.android.apis.app

Forwarding

public class Forwarding extends android.app.Activity

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.example.android.apis/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

Fields Summary
private android.view.View.OnClickListener
mGoListener
Constructors Summary
Methods Summary
protected voidonCreate(android.os.Bundle savedInstanceState)

        super.onCreate(savedInstanceState);

        setContentView(R.layout.forwarding);

        // Watch for button clicks.
        Button goButton = (Button)findViewById(R.id.go);
        goButton.setOnClickListener(mGoListener);