package soo.ui.notify;

import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class NotificationTest extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        final NotificationManager nm
        	= (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
        
        final Notification n 
        	= new Notification(R.drawable.j,"알림!!",System.currentTimeMillis());
        
        Button b = (Button)findViewById(R.id.button01);
        
        b.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				n.number++;
				// TODO Auto-generated method stub
				Intent i = new Intent(NotificationTest.this,NotificationTest.class);
				PendingIntent pi
					= PendingIntent.getActivity(NotificationTest.this, 0, i, 0);
				n.setLatestEventInfo(NotificationTest.this, 
						"제목", "점심시간입니다.", pi);
				nm.notify(1,n);
			}
		});
    }
}