Android PendingIntent Notification


まず、実現中のPendingIntentはIntentのパッケージだと感じました.
その3つのインスタンス化方法:
getActivity(Context, int, Intent, int)
getService(Context, int, Intent, int)
getBroadcast(Context, int, Intent, int)
現在のActivityのContextを保存し、外部でIntent動作を開始する感じです.コードContextに類似する.startActivity(*, *);
NotificationやAlarmとよく使われています.
コード例:
public class BannerActivity extends Activity {
	
	private Button b;
	private NotificationManager mNotificationManager;
	private Intent intent;
	private PendingIntent mPendingIntent;
	private Notification mNotification;

    /** Called when the activity is first created. */	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mNotificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
        
        b = (Button)this.findViewById(R.id.b);
        
        intent = new Intent(BannerActivity.this, Activity01.class);
        mPendingIntent = PendingIntent.getActivity(BannerActivity.this, 0, intent, Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
        mNotification = new Notification();
        
        b.setOnClickListener(new Button.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				mNotification.icon = R.drawable.ic_launcher;
				mNotification.tickerText = "  !"; //              
				mNotification.defaults = Notification.DEFAULT_SOUND; 
				
				//                ,           
				mNotification.setLatestEventInfo(BannerActivity.this, "  ?", "    !", mPendingIntent);
				mNotificationManager.notify(0, mNotification);
			}
		});
        
    }
}