1 package com.android.statusbartest;
2 
3 import android.app.Activity;
4 import android.app.NotificationManager;
5 import android.content.Intent;
6 import android.os.Bundle;
7 import android.util.Log;
8 import android.view.View;
9 
10 public class TestAlertActivity extends Activity {
11     int mId;
12 
13     @Override
onResume()14     public void onResume() {
15         super.onResume();
16         Log.d("StatusBarTest", "TestAlertActivity.onResume");
17         Intent intent = getIntent();
18         mId = intent.getIntExtra("id", -1);
19         Log.d("StatusBarTest", "Remembering notification id=" + mId);
20         setContentView(R.layout.test_alert);
21     }
22 
23     @Override
onPause()24     public void onPause() {
25         super.onPause();
26         Log.d("StatusBarTest", "onPause: Canceling notification id=" + mId);
27         NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
28         nm.cancel(mId);
29         finish();
30     }
31 
32     @SuppressWarnings({"UnusedDeclaration"})
dismiss(View v)33     public void dismiss(View v) {
34         Log.d("StatusBarTest", "TestAlertActivity.dismiss");
35         finish();
36     }
37 }
38