root/trunk/13.NotificationTest/src/soo/ui/notify/NotificationTest.java

리비전 34, 1.3 kB (mefour에 의해 체크인됨, 15 년 전)

--

Line 
1 package soo.ui.notify;
2
3 import android.app.Activity;
4 import android.app.Notification;
5 import android.app.NotificationManager;
6 import android.app.PendingIntent;
7 import android.content.Context;
8 import android.content.Intent;
9 import android.os.Bundle;
10 import android.view.View;
11 import android.view.View.OnClickListener;
12 import android.widget.Button;
13
14 public class NotificationTest extends Activity {
15     /** Called when the activity is first created. */
16     @Override
17     public void onCreate(Bundle savedInstanceState) {
18         super.onCreate(savedInstanceState);
19         setContentView(R.layout.main);
20        
21         final NotificationManager nm
22                 = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
23        
24         final Notification n
25                 = new Notification(R.drawable.j,"��┝!!",System.currentTimeMillis());
26        
27         Button b = (Button)findViewById(R.id.button01);
28        
29         b.setOnClickListener(new OnClickListener() {
30                        
31                         @Override
32                         public void onClick(View v) {
33                                 n.number++;
34                                 // TODO Auto-generated method stub
35                                 Intent i = new Intent(NotificationTest.this,NotificationTest.class);
36                                 PendingIntent pi
37                                         = PendingIntent.getActivity(NotificationTest.this, 0, i, 0);
38                                 n.setLatestEventInfo(NotificationTest.this,
39                                                 "��ぉ", "�����������", pi);
40                                 nm.notify(1,n);
41                         }
42                 });
43     }
44 }
참고: 소스 브라우저를 사용하면서 도움이 필요하다면, TracBrowser를 참고하십시오.