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 |
} |
---|