APIサンプル
Intentを作成して、別のActivityを開始する finish()で現在のActivityを終了する
private OnClickListener mGoListener = new OnClickListener() { public void onClick(View v) { // Here we start the next activity, and then call finish() // so that our own will stop running and be removed from the // history stack. Intent intent = new Intent(); intent.setClass(Forwarding.this, ForwardTarget.class); startActivity(intent); finish(); } };
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
android:gravity="center_horizontal"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<TextView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="0"
android:paddingBottom="4dip"
android:text="@string/forwarding"/>
<Button android:id="@+id/go"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="@string/go">
<requestFocus />
</Button>
</LinearLayout>