最終更新:2012-10-29 (月) 05:45:12 (4197d)  

android.app.PendingIntent
Top / android.app.PendingIntent

A description of an Intent and target action to perform with it.

タイミングを指定して発行することができるIntent

http://developer.android.com/reference/android/app/PendingIntent.html

  • ウィジェットのボタンがクリックされた時にインテントを発行
Intent buttonIntent = new Intent();//インテントを宣言
buttonIntent.setAction(BUTTON_CLICK_ACTION);
PendingIntent pendingIntent = PendingIntent.getService(this, 0, buttonIntent, 0);//送信先を指定
RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.main);
remoteViews.setOnClickPendingIntent(R.id.button, pendingIntent);//イベントを設定

タイミング

  • 時間を指定して発行
  • イベント発生時に発行

インテントを投げる先

  • PendingIntent.getActivities?(Context context, int requestCode, Intent[] intents, int flags)
  • PendingIntent.getActivity?(Context context, int requestCode, Intent intent, int flags)
  • PendingIntent.getBroadcast?(Context context, int requestCode, Intent intent, int flags)
  • PendingIntent.getService?(Context context, int requestCode, Intent intent, int flags)

関連

参考