1 package com.android.statusbartest; 2 3 import android.app.Activity; 4 import android.view.View; 5 import android.widget.TextView; 6 7 public class ConfirmationActivity extends Activity { 8 public static final String EXTRA_TITLE = "title"; 9 public static final String EXTRA_TEXT = "text"; 10 11 @Override 12 public void onResume() { 13 super.onResume(); 14 setContentView(R.layout.confirmation_activity); 15 setTitle(getTextExtra(EXTRA_TITLE, "Title")); 16 ((TextView)findViewById(R.id.text)).setText(getTextExtra(EXTRA_TEXT, "text")); 17 findViewById(R.id.ok).setOnClickListener(new View.OnClickListener() { 18 public void onClick(View v) { 19 finish(); 20 } 21 }); 22 } 23 24 private String getTextExtra(String extra, String def) { 25 final String text = getIntent().getStringExtra(extra); 26 if (text == null) { 27 return def; 28 } else { 29 return text; 30 } 31 } 32 } 33